[Zope3-Users] Generate edit form from user setting
Fred Drake
fdrake at gmail.com
Tue Aug 22 09:54:26 EDT 2006
On 8/22/06, Florian Lindner <mailinglists at xgm.de> wrote:
> I also thought about that. But if I write an adapter from PreferenceGroup to
> IUserSettings to all that the adapter would do is to assign values the values
> from the PreferenceGroup to IUserSettings. Ok it's more generic but at the
> end the same like assigned the values to the request itself.
As long as the adapter is trivial, it can be handled with __getattr__
and __setattr__ instead of a bunch of individual properties. That
also allows you to deal with evolution of the IUserSettings schema
more conveniently.
Another thing this buys you is that you're only dealing with
application-level values; the widget implementations become completely
irrelevant. Many widgets use more than one control these days; that's
something you don't need to deal with this way.
> Is it okay to change self.context in the __init__ method of the view class
> with a PreferenceGroup object? (I just didn't know it it's not confusing the
> something in the ComponentArchitecture...)
Sounds possible, but fragile. It should also be possible to
pre-populate the form's adapters dictionary (self.adapters).
-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