plone / plone.app.registry

provides Plone UI, persistence and GenericSetup integration for plone.registry
https://pypi.org/project/plone.app.registry
2 stars 6 forks source link

GenericSetup: Field-only import #58

Open reinhardt opened 2 years ago

reinhardt commented 2 years ago

I would like to import a GenericSetup upgrade profile that only makes sure that a certain registry record of type TextLine exists without overwriting any existing value. I can't find a way to do that.

If I provide an empty value then this value is set, even if I specify purge="false":

  <record name="mypackage.myfield">
    <field type="plone.registry.field.TextLine">
      <title>My Field</title>
      <required>False</required>
    </field>
    <value purge="false" />
  </record>

I can see that the purge parameter is only used for lists, dicts and similar, so this is apparently not the way to go.

If I don't provide a value element then an existing value is cleared:

  <record name="mypackage.myfield">
    <field type="plone.registry.field.TextLine">
      <title>My Field</title>
      <required>False</required>
    </field>
  </record>

I would expect that not providing a value node would preserve any existing value, but it doesn't. So is there another way to achieve this?