[Zope-dev] z3c.form: data manager forPersistentDict/PersistentMapping
Michael Howitz
mh at gocept.com
Mon Jul 13 06:58:07 EDT 2009
Am 12.07.2009 um 01:46 schrieb Roger Ineichen:
> Hi Michael
>
>> Betreff: [Zope-dev] z3c.form: data manager
>> forPersistentDict/PersistentMapping
>>
>> Hello,
>>
>> z3c.form.datamanager.DictionaryField is a data manager which
>> is registered for fields on a dict. In its __init__ it checks
>> whether the data object is an instance of dict. So this data
>> manager does neither work for UserDict nor
>> PersistentDict/PersistentMapping.
>> I'd like to change this but there are two possibilities and
>> I'm not sure which is the best one:
>>
>> 1.) Add a subclasses of DictionaryField which is registered
>> for UserDict and which checks whether the data object is an
>> instance of UserDict.
>> (PersistentDict and PersistentMapping are subclasses of
>> UserDict.)
>
> I think this is the right solution
I think so, too, but I was not sure.
> because there are many
> places in zope which do not work if a PeristentDict or
> PeristentList is given instead of a simple dict or list
> type.
>
> I'm not sure but I guess not even the zope.schema validation
> implementation does this part correct for list or dict fields.
This is another problem. z3c.form.datamanager.DictionaryField sets the
value directly on the dict, so I'd like to use a PersistentMapping
instead of a dict to get the persistency stuff for free. I use the
PersistentMapping to store the schema values, as I need to keep them
in the session.
Yours sincerely,
--
Michael Howitz · mh at gocept.com · software developer
gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1
Zope and Plone consulting and development
More information about the Zope-Dev
mailing list