Error on DCWorkflow import with cmf.pt (chameleon)

Bug #707927 reported by Asko Soukka
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zope CMF buildout
Fix Released
Low
Tres Seaver

Bug Description

While testing cmf.pt, I had to apply the attached patch to make XML-export & import working with Products.DCWorkflow (on a Plone setup).

I think, my attachment describes the problem pretty well.

1) The first error I got, was missing encoding, which was fixed by defining encoding on the XML template.

2) The second error was caused by missing attributes on the XML. The reason is, I guess, because of the differences in Chameleon's TAL-implementation, boolean values aren't implicitly converted into strings on tal:attributes, but the attributes are just silently dropped. The attributes in question were included on the resulting XML only after I applied explicit transforms from boolen to string using TAL's inline python.

Python 2.6.4
Zope 2.12.14
Products.DCWorkflow 2.2.2

(collective.wtf appearing in tracebacks is used to import workflows described in CSV and makes this problem more apparent, because it first generates XML-export using DCWorkflow's methods and only then asks DCWorkflow to import it, thus this error doesn't appear with working XML-exports, which are hand-crafted or generated without cmf.pt)

2011-01-26 13:37:47 INFO GenericSetup.workflow Workflow tool imported.
2011-01-26 13:37:47 INFO GenericSetup.workflow-csv Updating existing workflow definition simple_publication_workflow.
2011-01-26 13:37:47 ERROR Zope.SiteErrorLog 1296041867.930.658000886015 http://localhost:8081/plone/portal_setup/manage_importSelectedSteps
Traceback (innermost last):
  Module ZPublisher.Publish, line 127, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module Products.PDBDebugMode.runcall, line 70, in pdb_runcall
  Module ZPublisher.Publish, line 47, in call_object
  Module Products.GenericSetup.tool, line 503, in manage_importSelectedSteps
  Module Products.GenericSetup.tool, line 306, in runImportStepFromProfile
  Module Products.GenericSetup.tool, line 999, in _doRunImportStep
   - __traceback_info__: workflow-csv
  Module collective.wtf.exportimport, line 244, in importCSVWorkflow
  Module collective.wtf.exportimport, line 126, in _importBody
  Module Products.DCWorkflow.exportimport, line 154, in parseWorkflowXML
  Module xml.dom.minidom, line 1928, in parseString
  Module xml.dom.expatbuilder, line 940, in parseString
  Module xml.dom.expatbuilder, line 223, in parseString
LookupError: unknown encoding: None

2011-01-26 13:38:55 INFO GenericSetup.workflow Workflow tool imported.
2011-01-26 13:38:55 INFO GenericSetup.workflow-csv Updating existing workflow definition simple_publication_workflow.
2011-01-26 13:38:55 ERROR Zope.SiteErrorLog 1296041935.890.201639653402 http://localhost:8081/plone/portal_setup/manage_importSelectedSteps
Traceback (innermost last):
  Module ZPublisher.Publish, line 127, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module Products.PDBDebugMode.runcall, line 70, in pdb_runcall
  Module ZPublisher.Publish, line 47, in call_object
  Module Products.GenericSetup.tool, line 503, in manage_importSelectedSteps
  Module Products.GenericSetup.tool, line 306, in runImportStepFromProfile
  Module Products.GenericSetup.tool, line 999, in _doRunImportStep
   - __traceback_info__: workflow-csv
  Module collective.wtf.exportimport, line 244, in importCSVWorkflow
  Module collective.wtf.exportimport, line 126, in _importBody
  Module Products.DCWorkflow.exportimport, line 170, in parseWorkflowXML
  Module Products.DCWorkflow.exportimport, line 681, in _extractStateNodes
  Module Products.DCWorkflow.exportimport, line 1290, in _getNodeAttributeBoolean
  Module xml.dom.minidom, line 530, in __getitem__
KeyError: 'acquired'

Revision history for this message
Asko Soukka (asko-soukka) wrote :
Revision history for this message
Tres Seaver (tseaver) wrote :

Thanks for the bug report.

A couple of observations:

- xml documents are UTF-8 encoded by default. It seems as though
  your generated XML must have an unknown encoding value, maybe being
  generated oddly by cmf.pt.

- The missing attributes are likely missing because cmf.pt treats
  'None' as a signal to omit an attribute. I don't think having the
  string "None" for those attributes is the correct thing, either.

Could you please the generated (unparseable) XML being produced by
collective.wtf / DCWorkflow?

Changed in zope-cmf:
importance: Undecided → Low
status: New → Incomplete
Revision history for this message
Asko Soukka (asko-soukka) wrote :

Thank you for your quick response.

The encoding in XML is indeed "None" (I don't know why). In addition, it seems that cmf.pt treats also False as signal to omit an attribute.

I'll response with two attachment:

- example.dict is a dump of example workflow configuration parsed from CSV by collective.wtf (dumped using getWorkflowInfo(workflow_id))

- example.xml is a broken XML file exported from that configuration.

For the breakpoint I used for this exports, search for "xml_body" at
http://svn.plone.org/svn/collective/collective.wtf/trunk/collective/wtf/exportimport.py.

Revision history for this message
Asko Soukka (asko-soukka) wrote :
Revision history for this message
Asko Soukka (asko-soukka) wrote :

Just in case, the full list of packages (and their versions).

Revision history for this message
Tres Seaver (tseaver) wrote :

Thanks for the information. I would like to fix the second part of your
issue by making the code which parses the XML tolerant of the missing
values.

For the first part, I think we need to figure out how 'encoding=None' is
being passed to the template: it shouldn't be passing *any* encoding
AFAICT.

Changed in zope-cmf:
assignee: nobody → Tres Seaver (tseaver)
status: Incomplete → In Progress
Revision history for this message
Tres Seaver (tseaver) wrote :

I have checked in the first part of your patch (forcing the encoding to "UTF-8").

I also added tests and fixes for the parsing side, such that missing attributes get
mapped onto 'False':

See: http://svn.zope.org/Products.DCWorkflow/trunk/?rev=120334&view=rev

Changed in zope-cmf:
milestone: none → 2.3.0
status: In Progress → Fix Committed
Tres Seaver (tseaver)
Changed in zope-cmf:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.