[Grok-dev] Grok 1.1 breaks hurry.workflow or is something else wrong?

Sebastian Ware sebastian at urbantalk.se
Fri Jun 4 07:41:43 EDT 2010

This is a project that worked perfectly with Grok 1.0.2 but suddenly breaks in Grok 1.1.

I have created a new project, updated some imports that were complained about during startup. I added an application and initialised it to setup som default objects. That is when I get an error in hurry.workflow.

I have an index and the context is implemented in hurry.workflow. However, when the catalog indexes it, it doesn't seem to call the __init__ method on the WorkflowState class.

  File "/Users/jhsware/groksandbox/eggs/zope.catalog-3.8.1-py2.5.egg/zope/catalog/catalog.py", line 186, in indexDocSubscriber
    cat.index_doc(id, ob)
  File "/Users/jhsware/groksandbox/eggs/zope.catalog-3.8.1-py2.5.egg/zope/catalog/catalog.py", line 71, in index_doc
    index.index_doc(docid, texts)
  File "/Users/jhsware/groksandbox/eggs/zope.catalog-3.8.1-py2.5.egg/zope/catalog/attribute.py", line 137, in index_doc
    value = value()
  File "/Users/jhsware/groksandbox/eggs/hurry.workflow-0.11-py2.5.egg/hurry/workflow/workflow.py", line 126, in getId
    return self._annotations.get(self.id_key, None)
AttributeError: 'WorkflowState' object has no attribute '_annotations'

class WorkflowIndex(grok.Indexes):
    workflow_state = grok.index.Field(attribute='getState')
    workflow_id = grok.index.Field(attribute='getId')

class WorkflowState(object):
    state_key = "hurry.workflow.state"
    id_key  = "hurry.workflow.id"

    def __init__(self, context):
        # XXX okay, I'm tired of it not being able to set annotations, so
        # we'll do this. Ugh.
        from zope.security.proxy import removeSecurityProxy
        self.context = removeSecurityProxy(context)
        self._annotations = IAnnotations(self.context)
    def initialize(self):
        wf_versions = component.queryUtility(IWorkflowVersions)
        if wf_versions is not None:
    def setState(self, state):
        if state != self.getState():
            self._annotations[self.state_key] = state
    def setId(self, id):
        # XXX catalog should be informed (or should it?)
        self._annotations[self.id_key] = id
    def getState(self):
        return self._annotations.get(self.state_key, None)

    def getId(self):
        return self._annotations.get(self.id_key, None)

Mvh Sebastian

More information about the Grok-dev mailing list