[Zope] Making pythonscript changes to formulator fields persistent

Maciej Wisniowski maciej.wisniowski at coig.katowice.pl
Mon Apr 2 12:58:49 EDT 2007

> I was thinking of that...
> How would you do that? Do you know formulator enough to say?
I don't know your use case good enough. Is this just changing
attributes of formulator fields?

> Put the whole thing in the EM, or something simpler?
> An EM I could just hand off the field object to, to get "persisted"?
I don't understand what you mean. Field objects already are persistent.
EM gives you no security restrictions in comparision to Script Python.

In general to simply change field.values['required'] to false I'd write
function to traverse through ZODB to find all FormulatorForm objects
and it's fields.

> (I find it a bit cumbersome to develop in EMs, reloading and all, so I tend to 
> avoid it.)
With ExternalMethod you only have to hit save button again to refresh

Simple external method code that you may use to traverse through ZODB:

def checkFolder(self, fld):
    for obj_name, obj in fld.objectItems( 'FormulatorForm' ):
        # get form fields here etc

    for fld_name,fld_obj in fld.objectItems( 'Folder' ):
        checkFolder( fld_obj )
    for fld_name,fld_obj in fld.objectItems( 'Folder (Ordered)' ):
        checkFolder( fld_obj )

I'm not sure about 'FormulatorForm', this may be 'Formulator Form' or
something like that.

Maciej Wisniowski

More information about the Zope mailing list