-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
p.a.registry, DictRow and custom validator #14
Comments
I think this is not a problem with c.z.DGF but a general issue with plone.app.registry. The same problems apply fields using PersistentList (like Choice). I suggest you could try to file a support issue against p.a.registry (or their might already exist one). Then also, link the issue here so it does not get lost! |
It's a design choice in plone.registry to only support primitive field types included in zope.schema. The reason is that the fields are stored persistently and we don't want the registry to break if you remove some package. |
@naro : Just to check here - does c.z.dgf store DictRow objects or PersistentDicts? We could make it store the latter as PersistentDict is probably something we could allow by design decision. PersistentDicts and PersistentLists are probably not going away from Zope core (right?) and used by many fields. @davisagli what do you think? |
Not sure, ask @optilude |
If I check the underlying record in p.a.registry, it's class is a <type 'dict'>. Anyway, it works, but problem is if I register a validator which is strange. I don't understand why registerd validator should break a field persistence. |
@naro I just hit this exact same issue. I found that when the registry.xml is imported, the registry field is created in The adapter code is defined in https://github.com/plone/plone.registry/blob/4d03736d8cf41ffed2323ea6b6d40d2c4b6f7364/plone/registry/fieldfactory.py#L20 And at the very end, it will copy the properties from the zope.schema field to the new plone.registry field https://github.com/plone/plone.registry/blob/4d03736d8cf41ffed2323ea6b6d40d2c4b6f7364/plone/registry/fieldfactory.py#L60 What happens when you register a custom validator, is that the The way I found to solve this issue in my case, was to add
I am not 100% but this might be a solution that needs to be added to plone.registry, like https://github.com/plone/plone.registry/blob/4d03736d8cf41ffed2323ea6b6d40d2c4b6f7364/plone/registry/field.py#L280 |
My schema looks like:
and I'm using the schema as schema for controlpanel.RegistryEditForm (Plone 4.2). The control panel uses p.a.registry as a storage. When I try to apply p.a.registry GS profile, it fails on:
as soon as I remove the validator, p.a.registry GS step is applied without any problems. I have tried to register the validator as described in http://developer.plone.org/forms/z3c.form.html#form-widget-validators but the problem is the same.
The text was updated successfully, but these errors were encountered: