schema.py 920 Bytes
Newer Older
Nicolas Chauvat's avatar
Nicolas Chauvat committed
1
2
3
4
5
6
7
8

class Person(EntityType):
    """a physical person"""
    surname   = String(required=True, fulltextindexed=True, indexed=True, maxsize=64)
    firstname = String(fulltextindexed=True, maxsize=64)
    civility  = String(required=True, internationalizable=True,
                       vocabulary=(_('Mr'), _('Ms'), _('Mrs')),
                       default='Mr')
sylvain.thenault@logilab.fr's avatar
sylvain.thenault@logilab.fr committed
9
10

    description        = RichString(fulltextindexed=True)
Nicolas Chauvat's avatar
Nicolas Chauvat committed
11
12
13
14
15
16
17
18
19
20

    if 'PhoneNumber' in defined_types: # from addressbook package
        phone         = SubjectRelation('PhoneNumber', 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')])