[Zope3-Users] Generate edit form from user setting
Fred Drake
fdrake at gmail.com
Thu Aug 17 17:04:07 EDT 2006
On 8/17/06, Florian Lindner <mailinglists at xgm.de> wrote:
> 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).
Sounds like you want to create an adapter. The adapter is what's used
for getting/setting values.
> 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!).
Did you look at the get_rendered argument to
zope.formlib.form.FormField? Though I suspect the adapter I suggested
above would do the trick.
-Fred
--
Fred L. Drake, Jr. <fdrake at gmail.com>
"Every sin is the result of a collaboration." --Lucius Annaeus Seneca
More information about the Zope3-users
mailing list