# HG changeset patch # User Sylvain Thénault # Date 1434358009 -7200 # Node ID 67890235cb78166f33445434821ed032db19ad82 # Parent 82071f767cb8c86a4552d48e31bc23fe39e056ae [test] stop depending on the email cube for hooks test Backport necessary part of its schema. diff -r 82071f767cb8 -r 67890235cb78 hooks/test/data/bootstrap_cubes --- a/hooks/test/data/bootstrap_cubes Thu Jun 11 17:35:11 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -email diff -r 82071f767cb8 -r 67890235cb78 hooks/test/data/schema.py --- a/hooks/test/data/schema.py Thu Jun 11 17:35:11 2015 +0200 +++ b/hooks/test/data/schema.py Mon Jun 15 10:46:49 2015 +0200 @@ -16,7 +16,13 @@ # You should have received a copy of the GNU Lesser General Public License along # with CubicWeb. If not, see . -from yams.buildobjs import RelationDefinition, EntityType, String +from yams.buildobjs import (RelationDefinition, RelationType, EntityType, + String, Datetime, Int) +from yams.reader import context + +from cubicweb.schema import ERQLExpression + +_ = unicode class friend(RelationDefinition): subject = ('CWUser', 'CWGroup') @@ -36,3 +42,44 @@ subject = 'Folder' object = 'Folder' composite = 'subject' + + +class Email(EntityType): + """electronic mail""" + subject = String(fulltextindexed=True) + date = Datetime(description=_('UTC time on which the mail was sent')) + messageid = String(required=True, indexed=True) + headers = String(description=_('raw headers')) + + + +class EmailPart(EntityType): + """an email attachment""" + __permissions__ = { + 'read': ('managers', 'users', 'guests',), # XXX if E parts X, U has_read_permission E + 'add': ('managers', ERQLExpression('E parts X, U has_update_permission E'),), + 'delete': ('managers', ERQLExpression('E parts X, U has_update_permission E')), + 'update': ('managers', 'owners',), + } + + content = String(fulltextindexed=True) + content_format = String(required=True, maxsize=50) + ordernum = Int(required=True) + + +class parts(RelationType): + subject = 'Email' + object = 'EmailPart' + cardinality = '*1' + composite = 'subject' + fulltext_container = 'subject' + +class sender(RelationDefinition): + subject = 'Email' + object = 'EmailAddress' + cardinality = '?*' + inlined = True + +class recipients(RelationDefinition): + subject = 'Email' + object = 'EmailAddress'