[Zope-dev] z3c.form: data manager for PersistentDict/PersistentMapping
Michael Howitz
mh at gocept.com
Mon Jul 13 07:21:07 EDT 2009
Am 11.07.2009 um 17:43 schrieb Michael Howitz:
> 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.)
>
> 2.) Register DictionaryField for
> zope.interface.common.mapping.IMapping. This might have a problem as
> neither UserDict nor PersistentDict/PersistentMapping seem to provide
> this interface. (Why?)
Replying to myself, as I saw on the z3c.form trunk that
DictionaryField already allows providers of
zope.interface.common.mapping.IMapping additionally to dict instances
as the storage object.
The existing solution uses the second of my possibilities, but this is
not the one which I'd like to prefer, as it does not work with
PersistentMapping out of the box.
The idea behind this change on the trunk seems to be: to allow
SessionPkgData as storage. I currently do not use it directly but use
a PersistentMapping inside SessionPkgData. But maybe this is a
sufficient solution for now.
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