diff --git a/organize/README.txt b/organize/README.txt index e05d308..b6bbd17 100644 --- a/organize/README.txt +++ b/organize/README.txt @@ -1,7 +1,7 @@ Organizations: Persons, Institutions, Addresses... ================================================== -($Id$) + ($Id$) Let's start with a Person: @@ -34,10 +34,9 @@ Addresses Let's create an address and assign it to a person: - >>> from contact.address import Address - >>> addr = Address('München'.decode('UTF-8'), - ... 'Bayerstraße 1'.decode('UTF-8')) + >>> from cybertools.organize.party import Address + >>> addr = Address(u'New York', u'Broadway 1') >>> john.addresses['standard'] = addr >>> john.addresses['standard'].street - u'Bayerstra\xdfe 1' + u'Broadway 1' diff --git a/organize/interfaces.py b/organize/interfaces.py index 62daf2b..75d06a3 100644 --- a/organize/interfaces.py +++ b/organize/interfaces.py @@ -24,9 +24,21 @@ $Id$ """ from zope.interface import Interface, Attribute +from zope import schema class IPerson(Interface): - """ Just a person... + """ Resembles a human being with a name (first and last name), + a birth date, and a set of addresses. """ - age = Attribute('A float representing the age in years. Read-only.') + firstName = schema.TextLine(title=u'The first name') + lastName = schema.TextLine(title=u'The last name or surname') + birthDate = schema.Date(title=u'The date of birth - ' + 'should be a datetime.date object') + + addresses = Attribute('A mapping whose values provide the IAddress ' + 'interface') + + age = Attribute('The current age in full years, so this should ' + 'be an integer calculated dynamically, i.e. a read-only ' + 'attribute') diff --git a/organize/party.py b/organize/party.py index a17f5c2..7494217 100644 --- a/organize/party.py +++ b/organize/party.py @@ -52,10 +52,9 @@ class Person(object): class Address(object): - def __init__(self, title, city, lines=[], street=u'', + def __init__(self, city, street=u'', lines=[], zipcode=None, country=None): - self.title = title - self.lines = lines # a sequence of address lines + self.lines = lines # a sequence of additional address lines self.street = street self.zipcode = zipcode self.city = city