[Zope3-dev] Re: Merging schema & interfaces (was: "Sub interface")
Sidnei da Silva
sidnei at awkly.org
Tue Mar 2 10:35:12 EST 2004
On Tue, Mar 02, 2004 at 09:49:53AM -0500, Jim Fulton wrote:
| To deal with constraints on multiple fields, we will add the ability to
| model interface/schema-level invariants/constraints.
|
| def cityStateZip(contact):
| pc = lookupPostalCodeFor(contact.city, contact.state)
| if pc != contact.postal_code:
| raise InvalidPostalCode(contact)
|
| class IContact(zope.interface.Interface):
|
| postal_code = ...
| city = ...
| state = ...
|
| invariant(cityStateZip)
|
| Then, when we modify a contact, we can check individual
| field constraints *and* we can check the interface-level invariants.
|
| This has been on my unofficial to-do list for some time.
| It just needs a volunteer. :) (It's not on the official
| to-do list because we haven't actually needed it yet.)
This looks very good to me, and I even feel like volunteering, given
enough directions ;) I can probably find some time for this on our
current project, in the near future.
--
Sidnei da Silva <sidnei at awkly.org>
http://awkly.org - dreamcatching :: making your dreams come true
http://plone.org/about/team#dreamcatcher
Machine Always Crashes, If Not, The Operating System Hangs (MACINTOSH)
-- Topic on #Linux
More information about the Zope3-dev
mailing list