Commit 62a17b1c authored by Pierre-Yves David's avatar Pierre-Yves David
Browse files

merge stable into default

from yams.buildobjs import EntityType, SubjectRelation, String, RichString from yams.buildobjs import (EntityType, SubjectRelation, String, RichString,
RelationDefinition)
from yams.reader import context from yams.reader import context
from cubicweb.schema import RQLConstraint from cubicweb.schema import RRQLExpression, RQLConstraint
_ = unicode _ = unicode
...@@ -21,10 +23,30 @@ class Person(EntityType): ...@@ -21,10 +23,30 @@ class Person(EntityType):
if 'IMAddress' in context.defined: if 'IMAddress' in context.defined:
im_address = SubjectRelation('IMAddress', composite='subject') im_address = SubjectRelation('IMAddress', composite='subject')
use_email = SubjectRelation('EmailAddress', cardinality='*1', composite='subject')
# allowing an email to be the primary email of multiple persons is necessary for
# test at least :-/
primary_email = SubjectRelation('EmailAddress', cardinality='??',
constraints= [RQLConstraint('S use_email O')])
class use_email(RelationDefinition):
"""person's email account"""
__permissions__ = {
'read': ('managers', 'users', 'guests',),
'add': ('managers', RRQLExpression('U has_update_permission S'),),
'delete': ('managers', RRQLExpression('U has_update_permission S'),),
}
subject = "Person"
object = "EmailAddress"
cardinality = '*?'
composite = 'subject'
class primary_email(RelationDefinition):
"""person's primary email account"""
__permissions__ = {
'read': ('managers', 'users', 'guests',),
'add': ('managers', RRQLExpression('U has_update_permission S'),),
'delete': ('managers', RRQLExpression('U has_update_permission S'),),
}
subject = "Person"
object = "EmailAddress"
cardinality = '??'
constraints= [RQLConstraint('S use_email O')]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment