[schema] use definition for `use_email` relation instead of type declaration (closes: #1894929)
This will be more adaptable for other existent `use_relastion` as the one in the cube Person.
--- a/schemas/base.py Thu Aug 04 12:11:36 2011 +0200
+++ b/schemas/base.py Wed Aug 03 13:28:06 2011 +0200
@@ -46,8 +46,6 @@
# test at least :-/
primary_email = SubjectRelation('EmailAddress', cardinality='??',
description=_('email address to use for notification'))
- use_email = SubjectRelation('EmailAddress', cardinality='*?', composite='subject')
-
in_group = SubjectRelation('CWGroup', cardinality='+*',
constraints=[RQLConstraint('NOT O name "owners"')],
description=_('groups grant permissions to the user'))
@@ -71,13 +69,20 @@
to indicate which is the preferred form.'))
class use_email(RelationType):
- """ """
+ fulltext_container = 'subject'
+
+class use_email_relation(RelationDefinition):
+ """user's email account"""
+ name = "use_email"
__permissions__ = {
'read': ('managers', 'users', 'guests',),
'add': ('managers', RRQLExpression('U has_update_permission S'),),
'delete': ('managers', RRQLExpression('U has_update_permission S'),),
}
- fulltext_container = 'subject'
+ subject = "CWUser"
+ object = "EmailAddress"
+ cardinality = '*?'
+ composite = 'subject'
class primary_email(RelationType):
"""the prefered email"""