Hi eveyone.

While playing around with the development version of ACS (ArsDigita Community
System), I noticed a very nice feature they introduced, namely page contracts.

In ACS, this means that every tcl page starts with a call to ad_page_contract.
In the parameters passed, you specify:
   - general page documentation (what it does)
   - author(s)
   - creation date (not needed for Zope since we have bobobase_modification_time)
   - CVS ID (not quite applicable for Zope (yet?))
   - the expected input variables (from forms) along with their default values
   (where applicable) and types (having a couple of types like "integer" and "string"
   predefined and an easy-to-use plugin system to add custom types)
   - an optional validation block in which you can check the input data ranges
   and validity (you can also make validation rules depend on each other so if
   one fails, the rules which depend on it aren't tried)
   - an optional custom error messages section (to use when one of the required
   input variables is not there or does not match the format, or when a validation
   block fails). If you don't provide this some reasonable defaults are provided.

IMHO, such a feature would be very useful for Zope too. I find myself quite 
often doing input validation and error handling in DTML, which is (to say the
least) painful.

I would be interested to give a try at implementing this, but before starting
I wanted to hear community's opinion on:
   - whether this would be useful
   - how this should be aproached (the two possibilities I have in mind until
   now are either a separate manage tab for the page contract, and there a
   HTML-based interface for building it, either a <dtml-contract> tag which
   surrounds the page contract (written in python probably) and placed at the
   top of DTML documents/methods).

Petru Paler, mailto:[EMAIL PROTECTED]
http://www.ppetru.net - ICQ: 41817235

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to