Re: Validation and Events

Martin Aspeli <[email protected]> Mon, 25 Sep 2006 21:48:13 +0100
Newsgroups gmane.comp.web.zope.plone.archetypes.devel
Message-ID <[email protected]>
Hi George,

> The thought was maybe there was an event that fired up upon validation through
> base_edit and process_form, that would allow one to add some more work to the
> validation process of a product without touching its code.

I think that would be a nice goal.

Can you think of how to do it? It'd probably need to come from 
post_validate, and pass along the 'errors' dict to the event so that it 
could be populated.

Also - I don't remember whether notify() blocks until all event handlers 
have completed or not. Presuming it does, that approach could work.

I'd even consider putting it on the schema-by-iface branch, since it's 
quite simple and non-invasive.

> That's too bad ... in this case I'm adding a "Deadline Date" and "Deadline Text"
> field to multiple content types, but want to valdiate that either neither is
> entered or both are entered. It seems like allowing some of this multiple-field
> validation would be key down the road to the work to use schemas by interface or
> otherwise generalize Schema(). Are there any plans to build Zope3 invariants
> into the Archetypes machinery?

Maybe, but that'd probably be a bigger exercise.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV