Ejemplo n.º 1
0
def remove_workflow_extension(e):

    from cocktail.persistence import datastore
    from woost.models import Item, Extension

    for extension in Extension.select():
        bp = getattr(extension, "__Broken_Persistent__", None)

        if bp is not None and bp.__name__ == "WorkflowExtension":
            id = extension.__Broken_state__["_id"]

            try:
                Item.index.remove(id, None)
            except KeyError:
                pass

            try:
                Item.keys.remove(id)
            except KeyError:
                pass

            try:
                Extension.keys.remove(id)
            except KeyError:
                pass

            break

            for member in Extension.members().itervalues():
                if member.indexed:
                    member.rebuild_index()

    for key in list(datastore.root):
        if key.startswith("woost.extensions.workflow"):
            datastore.root.pop(key)
Ejemplo n.º 2
0
 def enable_extensions(self):
     # Enable the selected extensions
     if self.extensions:
         load_extensions()
         for extension in Extension.select():
             ext_name = extension.__class__.__name__[:-len("Extension"
                                                           )].lower()
             if ext_name in self.extensions:
                 extension.enabled = True