Esempio n. 1
0
def removeDoubleGenericSetupSteps(portal, out):
    """Remove all GenericSetup steps that are registered both using
    zcml and in the persistent registry from the persistent registry.
    """
    st = getToolByName(portal, "portal_setup")
    view = ImportStepsView(st, None)
    steps = [step["id"] for step in view.doubleSteps()]
    if steps:
        for step in steps:
            st._import_registry.unregisterStep(step)
        st._p_changed = True
        out.append("Removed doubly registered GenericSetup import steps: %s" %
                   " ".join(steps))

    view = ExportStepsView(st, None)
    steps = [step["id"] for step in view.doubleSteps()]
    if steps:
        for step in steps:
            st._export_registry.unregisterStep(step)
        out.append("Removed doubly registered GenericSetup export steps: %s" %
                   " ".join(steps))
 def testNoInvalidGenericSetupExportSteps(self):
     view = ExportStepsView(self.setup, None)
     self.assertEqual([i['id'] for i in view.invalidSteps()], [])
 def testNoDoubleGenericSetupExportSteps(self):
     view = ExportStepsView(self.setup, None)
     self.assertEqual([i['id'] for i in view.doubleSteps()], [])