cybertools/organize/party.py
helmutm 32beb7824f created 'cybertools.organize' package, removed 'cybertools.contact', moved imports (in testing code only) of the latter package to the former one.
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@1203 fd906abe-77d9-0310-91a1-e0d9ade77398
2006-05-10 16:10:51 +00:00

78 lines
2.4 KiB
Python

#
# Copyright (c) 2006 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
"""
A set of simple application classes for contact management to be used
as an example for some of the cybertools packages.
$Id$
"""
from zope.interface import implements
from datetime import date
from cybertools.organize.interfaces import IPerson
class Person(object):
implements(IPerson)
def __init__(self, lastName, firstName=u'', birthDate=None):
self.lastName = lastName
self.firstName = firstName
self.birthDate = birthDate
self.moreFirstNames = None
self.personalAddress = 'mrs' # or 'mr', 'ms', None (unknown)
self.academicTitle = None
self.communicationInfos = []
self.addresses = {} # keys: 'standard', ...?
self.affiliations = {} # keys: 'employed', ...?
@property
def age(self):
if self.birthDate is None:
return None
return int((date.today() - self.birthDate).days/365.25)
class Address(object):
def __init__(self, title, city, lines=[], street=u'',
zipcode=None, country=None):
self.title = title
self.lines = lines # a sequence of address lines
self.street = street
self.zipcode = zipcode
self.city = city
self.country = country # 'de', 'at', 'us', ...
class Institution(object):
def __init__(self, title):
self.title = title
self.addresses = {}
class CommunicationInfo(object):
def __init__(self, commType, qualifier, address):
self.commType = commType # e.g. 'email', 'phone', ...
self.qualifier = qualifier # e.g. 'private', or institution
self.address = address # the real address or number