[Zope] assignment to form records

Fernando Martins fmartins@hetnet.nl
Mon, 10 Mar 2003 21:17:57 +0100


Edward Muller wrote:
> I would love a an equivalent :object and :objects flag something like
> this:
>
> <dtml-in "range(item_count)">
>   <input type=text size=30 name="items.desc:objects:Item">
>   <input type=text size=15 name="items.item:objects:Item">
>   <input type=text size=10 name="items.qty:objects:Item">
> </dtml-in>
>
> Where an 'object' (or objects) is created (Python class is instantiated)
> and getter and setter methods for .desc, .item and .qty get called with
> the provided values. For instance the above snippet would create a new
> object called items, which is an instance of class Item. Class Item
> would have get_desc, get_item, get_qty, set_desc, set_item, set_qty
> methods. These would then act as classic getter and setter methods.
>

It would be nice to see some facilities in this direction. I'm far from
fully understanding Zope (I'm at basic ZPT/Scripts/Python level), but maybe
something like having a product called Object which allows to specify
fields, default values, validation rules and error messages.

With an Object called Item one could have validation rules being generated
in Javascript (<tal:replace=Item/rules/> ???). When zope receives the form
data it would validate the data according to Item specification (fields,
rules) and deal with the security concerns pointed by Dylan (missing fields,
wrong types).

Validation rules could be simple logical expressions (from which Javascript
and Python code could be generated) or Python scripts (in this case a
Javascript alternative would have to be provided).

Of course, then some people would want an UML modeling tool to
generate/maintain Objects in Zope.

Is this far fetched for Zope? ;-)

Regards,
Fernando