zopefoundation / z3c.form

An advanced form and widget framework for Zope 3
Other
8 stars 39 forks source link

Document how to use DictionaryField so it does not get picked up in "undesired scenarios" #33

Open petri opened 8 years ago

petri commented 8 years ago

In DictionaryField datamanager docstring it says:(https://github.com/zopefoundation/z3c.form/blob/3.2.7/src/z3c/form/datamanager.py#L110-L114)

NOTE: Even though, this data manager allows nearly all kinds of
mappings, by default it is only registered for dict, because it
would otherwise get picked up in undesired scenarios. If you want
to it use for another mapping, register the appropriate adapter in
your application.

What does this mean? Why would it be not safe to register DictionaryField datamanager for PersistentDict (handy for using z3c.form with annotations)? Would it then be better to subclass PersistentDict and register DictionaryField for that (makes things potentionally brittle though)?