def createWorkFlowContainer(event):
    site = event.object
    sm = site.getSiteManager()

    site['workflow'] = container = WorkFlowContainer()

    container['contributor'] = contributor = WorkList()
    sm.registerUtility(contributor, interfaces.IWorkList, name='contributor')
    dc = IWriteZopeDublinCore(contributor)
    dc.title = u"Contribution"
    dc.description = u"List of work items to be worked on by contributors."

    container['editor'] = editor = WorkList()
    sm.registerUtility(editor, interfaces.IWorkList, name='editor')
    dc = IWriteZopeDublinCore(editor)
    dc.title = u"Editorial Review"
    dc.description = u"List of work items to be reviewed by the site's editors."

    container['technicaleditor'] = technicaleditor = WorkList()
    sm.registerUtility(technicaleditor,
                       interfaces.IWorkList,
                       name='technicaleditor')
    dc = IWriteZopeDublinCore(technicaleditor)
    dc.title = u"Technical Review"
    dc.description = u"List of work items to be reviewed by the site's technical staff."

    container['script'] = script = WorkList()
    sm.registerUtility(script, interfaces.IWorkList, name='script')
    dc = IWriteZopeDublinCore(script)
    dc.title = u"Script"
    dc.description = u"List of work items generated by automatic scripts, e.g. database evolutions. Scripts usually create a huge bunch of items."

    sm['default']['workflow-relevant-oids'] = oids = SetIndex()
    sm.registerUtility(oids, IIndex, name='workflow-relevant-oids')

    sm['default']['workitem-contributor'] = contribs = SetIndex()
    sm.registerUtility(contribs, IIndex, name='workitem-contributors')

    sm['default']['workitem-processid'] = processid = ValueIndex()
    sm.registerUtility(processid, IIndex, name='workitem-processid')

    sm['default']['worklist-value'] = idx = ValueIndex()
    sm.registerUtility(idx, IIndex, name='worklist-value')
Exemple #2
0
def evolve(context):
    """ create workflow components
    """

    # We moved the imports here because of getInfo which only takes
    # the __doc__ string in evolve. getInfo should not import
    # anything.
    import zope.interface
    import zope.component
    from zope.app.zopeappgenerations import getRootFolder
    from zope.app.generations.utility import findObjectsProviding
    from zope.app.component import hooks
    
    from quotationtool.site.interfaces import IQuotationtoolSite

    root = getRootFolder(context)

    site = None
    for s in findObjectsProviding(root, IQuotationtoolSite):
        site = s
        break
    if site is None:
        raise Exception('No quotationtool site!')
    hooks.setSite(site)

    sm = site.getSiteManager()
    default = sm['default']

    from zope.dublincore.interfaces import IWriteZopeDublinCore
    from quotationtool.workflow.container import WorkFlowContainer
    from quotationtool.workflow.worklist import WorkList
    from quotationtool.workflow import interfaces
    from z3c.indexer.index import SetIndex
    from z3c.indexer.interfaces import IIndex

    site['workflow'] = container = WorkFlowContainer()

    container['contributor'] = contributor = WorkList()
    sm.registerUtility(contributor, interfaces.IWorkList, name='contributor')
    dc = IWriteZopeDublinCore(contributor)
    dc.title = u"Contribution"
    dc.description = u"List of work items to be worked on by contributors."

    container['editor'] = editor = WorkList()
    sm.registerUtility(editor, interfaces.IWorkList, name='editor')
    dc = IWriteZopeDublinCore(editor)
    dc.title = u"Editorial Review"
    dc.description = u"List of work items to be reviewed by the site's editors."

    container['technicaleditor'] = technicaleditor = WorkList()
    sm.registerUtility(technicaleditor, interfaces.IWorkList, name='technicaleditor')
    dc = IWriteZopeDublinCore(technicaleditor)
    dc.title = u"Technical Review"
    dc.description = u"List of work items to be reviewed by the site's technical staff."

    container['script'] = script = WorkList()
    sm.registerUtility(script, interfaces.IWorkList, name='script')
    dc = IWriteZopeDublinCore(script)
    dc.title = u"Script"
    dc.description = u"List of work items generated by automatic scripts, e.g. database evolutions. Scripts usually create a huge bunch of items."

    sm['default']['workflow-relevant-oids'] = oids = SetIndex()
    sm.registerUtility(oids, IIndex, name='workflow-relevant-oids')

    sm['default']['workitem-contributor'] = contribs = SetIndex()
    sm.registerUtility(contribs, IIndex, name='workitem-contributors')