[Zope3-Users] Generate edit form from user setting

Florian Lindner mailinglists at xgm.de
Thu Aug 17 16:54:01 EDT 2006

I have a zope.app.preference.preference.PreferenceGroup based on an 
IUserSettings interface for which I want to generate an edit form.
I've tried to do it with a class based on EditForm but that does not worked 
for me since the EditFrom changes the self.context object. If I simply 
replace self.context by the object I got from UserPreferences it complains 
about PreferenceGroup being not adaptable to IUserSettings (and it's right 
about that).

class UserSettings(form.Form):
    form_fields = form.Fields(IUserSettings, render_context = False)
    def handle_change_action(self, action, formData):

Of course I need to initialize the from with the values from the the 
PreferenceGroup object. Is there a better way than modifying the request like 
request.form['form.max_size'] for each field? I couldn't find one in the 
documentation but I'm almost sure there is a more elegant solution (since 
it's Zope!).



More information about the Zope3-users mailing list