1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
from zope.interface import implements
from zope.app.container.btree import BTreeContainer
from zope.app.container.contained import Contained
from zope.app.authentication import principalfolder
from zope.traversing.browser.interfaces import IAbsoluteURL
from zope.app import zapi
from zope.annotation.interfaces import IAttributeAnnotatable
from interfaces import IPerson, IPersonContainer, IPersonContained
import app
class Person(principalfolder.InternalPrincipal, Contained):
"""An implementation of IPerson"""
implements(IPerson, IPersonContained,
IAttributeAnnotatable)
timeZone = 'UTC'
class PersonContainer(principalfolder.PrincipalFolder):
"""Container of persons"""
implements(IPersonContainer,
IAttributeAnnotatable)
def getPersonFromPrincipal(principal):
"""Adapter from IPrincipal to IPerson"""
return app.getTimeClockApplication()['users'][principal.id]
|