[Python-Dev] Thoughts on validation, events, rules (original) (raw)

Jim Fulton jim at zope.com
Sun Aug 8 15:53:46 CEST 2004


I'm a bit unsatisfied with container constraints:

http://dev.zope.org/Zope3/ContainmentConstraints

While I think this was a step forward conceptually, it has turned out to be a bit unwieldy in practice:

I've been thinking of other ways to solve this problem.

In the context of schema validation, we've been thinking of using subscription adapters:

http://dev.zope.org/Zope3/NoMoreSchemaBinding

http://mail.zope.org/pipermail/zope3-dev/2004-June/011315.html

The advantage of subscription adapters is that they provide the ability to express constraints in a highly flexible and decentralized manner. Another advantage of using subscription adapters is that doing so takes advantage of a highly optimized mechanism and should be fairly efficient.

It occurred to me today that subscription adapters provide a form of rule-based processing. Any number of rules (subscribers) can fire as the result of some event, where an event could take the form of a query, such as "validate adding this object to this container" or "validate setting this attribute to this value".

It's interesting to note that validating adding an object to a container and validating assigning an attribute are both special cases of validating establishing a relationship between two objects.

Jim

-- Jim Fulton mailto:jim at zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org



More information about the Python-Dev mailing list