zestsoftware / Products.eXtremeManagement

2 stars 1 forks source link

Extreme Management 2.0.4: Workflow status change for task in story view problem. Taks title contain ł letter #2

Closed drnow4u closed 10 years ago

drnow4u commented 10 years ago

Extreme Management (XM)2.0.4 is installed on Plone 3.3.6 and when I try to change the workflow status for task (task title containing ex. ł letter) on the story page it wouldn't work. In the prefs_error_log_form is the following message:

Traceback (innermost last):
  Module ZPublisher.Publish, line 119, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 42, in call_object
  Module <wrapper>, line 5, in wrapper
  Module kss.core.actionwrapper, line 238, in apply
  Module Products.eXtremeManagement.browser.xm_kss, line 116, in xmChangeWorkflowState
  Module Products.CMFFormController.FSControllerPythonScript, line 104, in __call__
  Module Products.CMFFormController.Script, line 145, in __call__
  Module Products.CMFCore.FSPythonScript, line 140, in __call__
  Module Shared.DC.Scripts.Bindings, line 313, in __call__
  Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec
  Module Products.CMFCore.FSPythonScript, line 196, in _exec
  Module None, line 55, in content_status_modify
   - <FSControllerPythonScript at /dev/content_status_modify used for /dev/p6-control/control/poprawki/2>
   - Line 55
  Module Products.CMFPlone.utils, line 458, in transaction_note
  Module transaction._transaction, line 589, in note
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 23: ordinal not in range(128)

Moreover the same trace back message is in replay part of the POST message. There is no such problem when I change workflow status form task view. The different is only URL Referer in the POST. The not working POST Referer is:

http://localhost:8084/dev/p6-control/control/poprawki

The working POST Referer is: http://localhost:8084/dev/p6-control/control/poprawki/2

The is some related to this problem information:

https://dev.plone.org/ticket/12765

https://github.com/spereverde/Products.CMFPlone/commit/bc052c9133c81bb0555e449fc0b7d4cbb7454d70

I have already above path in the source code.

Probably somewhere in the source of ZOPE/Plone/CMF/XM is obj.title_or_id() instead of obj.getId(). One of ZOPE/Plone/CMF/XM function is expecting regular ANSII string in the argument and instead of it get UNICODE string.

If the problem is not in the XM itself maybe it should be patched in the XM?

Component version:

    Plone 3.3.6
    CMF 2.1.3
    Zope (Zope 2.10.13-final, python 2.4.6, linux3)
    Python 2.4.6 (#1, Mar 8 2014, 14:59:37) [GCC 4.6.3]
    PIL 1.1.7
   Extreme Management   2.0.4

Above problem not appear in the following configuration:

    Plone 4.2.7 (4213)
    CMF 2.2.7
    Zope 2.13.21
    Python 2.7.5 (default, Mar 8 2014, 20:39:16) [GCC 4.6.3]
    PIL 1.7.8 (Pillow)
    Extreme Management 2.1a5 

Honestly, I like to move from Plone 3.3.6 to Plone 4 but issue:

https://github.com/zestsoftware/Products.eXtremeManagement/issues/1 https://github.com/zestsoftware/xm.theme/issues/1

is blocking so I keep production portal on Plone 3.

mauritsvanrees commented 10 years ago

Strange that I have not noticed this before. I can reproduce it in Plone 3.3.6 by creating a task with accented characters.

In Products.eXtremeManagement.browser.xm_kss we call this line, which is where it goes wrong:

obj.content_status_modify(action)

A workaround would be to change this to change the title of the object to something safe, then call this line, then change the title back again. But that is a bit too silly for my taste.

The real problem is in the script that is called here. It is in Products/CMFPlone/skins/plone_form_scripts/content_status_modify.cpy and goes wrong in this line:

note = 'Changed status of %s at %s' % (wfcontext.title_or_id(), wfcontext.absolute_url())

You could customize that script in your site and change title_or_id to getId to fix it.

drnow4u commented 10 years ago

I fix this problem changing xm_kss.py line 116 from:

    obj.content_status_modify(action)

to

   wftool = getToolByName(context, 'portal_workflow')
   wftool.doActionFor(obj, action=action)

It's working fine. Could you release Products.eXtremeManagement 2.0.5 with your or mine path?

mauritsvanrees commented 10 years ago

Ah, that is much better of course. Thanks! I have released 2.1a7 with this fix. There should be no reason to stay on 2.0.x and I am not planning to make any releasing in that line again. We are using 2.1x on our production Plone 3.3.6 site.