work-in-progress: cybertools.organize
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@1205 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
711f7c52a4
commit
440926b022
3 changed files with 20 additions and 10 deletions
|
@ -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'
|
||||
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue