bug fix for age calculation with missing birth date

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2439 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2008-03-07 11:27:00 +00:00
parent 85d2423663
commit fc6660a457

View file

@ -32,7 +32,7 @@ from cybertools.organize.interfaces import IPerson, IAddress
class Person(object):
implements(IPerson)
def __init__(self, lastName, firstName=u'', birthDate=None):
self.lastName = lastName
self.firstName = firstName
@ -49,7 +49,7 @@ class Person(object):
return self.ageAt(date.today())
def ageAt(self, date):
if self.birthDate is None:
if not self.birthDate:
return None
return int((date - self.birthDate).days/365.25)