migrationploneplone-5.x

Content migration of plone dexterity content types in plone 5


I have a dexterity content type defined as model in Employee.xml.

<model xmlns="http://namespaces.plone.org/supermodel/schema"
   xmlns:marshal="http://namespaces.plone.org/supermodel/marshal"
   xmlns:i18n="http://xml.zope.org/namespaces/i18n"
   i18n:domain="plone">
  <schema>
    <field name="fullname" type="zope.schema.TextLine">
      <description />
      <required>True</required>
      <title>Firstname and Surname</title>
    </field>
    <field name="position" type="zope.schema.TextLine">
      <description />
      <required>True</required>
      <title>Position</title>
    </field>
  </schema>
</model>

Very easy. The class is defined in content.py.

class Employee(Item):
    """Convenience subclass for ``Employee`` portal type
    """

There are some instances of Employee in my database.

Now I want to add a new feature to my content type.

class Employee(Item):
    """Convenience subclass for ``Employee`` portal type
    """

    def Title(self):
        return self.fullname

Now I can see the fullname of the employee in the folder_contents view. But it works only for instances added after the modification. The "old" content seems to need a migration. My question: How? The docs did not help. (https://docs.plone.org/develop/plone/persistency/migrations.html)


Solution

  • The older instances haven't been re-indexed, so everything based on the catalog (collections, navigation, search, folder content, etc.) cannot be aware of their new Title attribute.

    Just reindex your portal_catalog and it will be fine.