[ZPT] Re: Fwd: writing data to zope objects

Raphael Ritz r.ritz at biologie.hu-berlin.de
Tue Jun 1 04:34:01 EDT 2004



Michael A Rowley wrote:
> Ok, this is driving me nuts!  I have fished through the source till I am 
> almost cross eye'ed...  I can find no-where in the source calls where 
> any reference to REQUEST is made to get the post data, or to any method 
> to write the data to the objects... I have read the Formulator stuff, 
> and am thinking it may be doing this automatically?  I have no idea how 
> that is done....  But I think I can brute force this with something like
> 

On submitting the edit form 'content_edit.cpy' (skin method)
is called (as defined by the form controller actions).

content_edit calls 'processForm' (defined in BaseObject)
which calls '_processForm' (again in BaseObject) which iterates
over the fields. Doing so, it calls 'processForm from the
widget before eventually obtaining the mutator of the field
and calling it with the result of the widget's processForm.

The mutator is either explicitly defined at the individual field
or auto-generated from the AT machinery and usually calls the
field's 'set' method.

Furthermore, BaseObject provides an 'edit' method which
calls 'update' which in turn calls 'updateAll' from the schema.

When working TTW the values entered by the user (from the REQUEST)
are always passed through as keyword arguments (**kw).

What else do you need?

> object.field=REQUEST[field_name] 

Don't do that as it breaks archetype's storage concept
(you are explicitly enforcing attribute storage here)


> as long as all my field names are 
> unique in my archetypes definitions...  I can write a validator to do 
> this (I think).
> 

for custom validators, provide an xxx.vpy script and
use the form controller.

HTH,

	Raphael





More information about the ZPT mailing list