Skip to content

"root -> root_uid" migration code buggy (at least for the INavigation portlet) #138

Description

@d-maurer

plone.app.portlets.portlets.navigation.Assignment used to following code to migrate from the old toot field to the new root_uid field:

    def _root(self):
        # This is only called if the instance doesn't have a root_uid
        # attribute, which is probably because it has an old 'root'
        # attribute that needs to be converted.
        root = self.root
        if not root:
            return None
        portal = getToolByName(self, 'portal_url').getPortalObject()
        navroot = getNavigationRootObject(self, portal)
        try:
            root = navroot.unrestrictedTraverse(root.lstrip('/'))
        except (AttributeError, KeyError, TypeError, NotFound):
            return
        return root.UID()
    root_uid = ComputedAttribute(_root, 1)

This code fails (to determine the correct root) because getNavigationRootObject returns the portlet assignemt mapping (the parent of the portlet assignment) and nothing fit to perform a tracersal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions