コード例 #1
0
 def _purgeCustomMenu(self, context):
     """Remove the interface and annotation from an object
     """
     if ICustomMenuEnabled.providedBy(context):
         annotation = ICustomMenuFactoriesAssignment(context)
         annotation.remove()
         noLongerProvides(context, ICustomMenuEnabled)
         context.reindexObject(idxs=["object_provides"])
コード例 #2
0
def cleanMenuCustomizations(portal):
    """Remove all customization from the Plone site"""
    catalog = portal.portal_catalog
    results = catalog(object_provides=ICustomMenuEnabled.__identifier__)
    for x in results:
        obj = x.getObject()
        interface.noLongerProvides(obj, ICustomMenuEnabled)
        annotations = IAnnotations(obj)
        del annotations[ANN_CUSTOMMENU_KEY]
        print 'Removing customization of the "Add new..." menu at %s' % x.getPath()
        obj.reindexObject(['object_provides'])
    # Also the Plone site can be customized... check manually as it isn't in the catalog
    if ICustomMenuEnabled.providedBy(portal):
        interface.noLongerProvides(portal, ICustomMenuEnabled)
        annotations = IAnnotations(portal)
        del annotations[ANN_CUSTOMMENU_KEY]
        print 'Removing customization of the "Add new..." menu in the Plone site'