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

Vincent Fretin vincent.fretin at gmail.com
Sat Jun 5 11:05:01 EDT 2010


Hi,

This a change in hurry.workflow-0.11.
I think WorkflowState is not meant to be persisted.

You should probably stick to hurry workflow 0.10 if you have persisted
WorkflowState object in the catalog or do an upgrade script...

Vincent Fretin


On Fri, Jun 4, 2010 at 1:41 PM, Sebastian Ware <sebastian at urbantalk.se> wrote:
> 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'
>
> [snip]
> class WorkflowIndex(grok.Indexes):
>    grok.site(ProtonCMS)
>    grok.context(IWorkflowState)
>    grok.name('workflow_catalog')
>
>    workflow_state = grok.index.Field(attribute='getState')
>    workflow_id = grok.index.Field(attribute='getId')
> [snip]
>
>
> [snip]
> class WorkflowState(object):
>    implements(IWorkflowState)
>    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:
>            self.setId(wf_versions.createVersionId())
>
>    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)
> [snip]
>
>
> Mvh Sebastian
>
>
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> https://mail.zope.org/mailman/listinfo/grok-dev
>


More information about the Grok-dev mailing list