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:
parent
85d2423663
commit
fc6660a457
1 changed files with 2 additions and 2 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue