action_id not substituted in "No Workflow provides the '${action_id}' action"

Bug #495775 reported by FreyP on 2009-12-12
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Zope CMF buildout
Undecided
Unassigned

Bug Description

CMFCore 2.1.2 does not substiture ${action_id} in the error message "No Workflow provides the '${action_id}' action"
generated in CMFCore/WorkflowTool.py, WorkflowTool.doActionFor on line 237

this makes it difficult to find out what action was involved in the error - and should be fixed.

note that we do not need and use i18n as we are have only german language content and frontends.

here a sample traceback (from an internal discussion on december 8th):

 *Time* 2009/12/08 09:24:38.445797 GMT+1
 *User Name (User Id)* MarrS (MarrS)
 *Request URL*
 _http://10.11.1.215:8080/Production/HaufeCMS/Data/Div/Toolbox/RE/415/HI1496415/tbMakeVersion_

 *Exception Type* WorkflowException
 *Exception Value* No workflow provides the '${action_id}'
 action.

 Traceback (innermost last):

    * Module ZPublisher.Publish, line 126, in publish
    * ...
    * Module None, line 85, in tbMakeVersion
      *<TrustedFSPythonScript at /Production/HaufeCMS/tbMakeVersion
      used for /Production/HaufeCMS/Data/Div/Toolbox/RE/415/HI1496415>*
      *Line 85*
    * Module Products.HaufeCMS.Transactions, line 54, in __call__
    * Module Haufe.Transactions.TransactionHandler, line 94, in __call__
    * Module None, line 17, in makeVersion
      *<TrustedFSPythonScript at /Production/HaufeCMS/tbMakeVersion
      used for /Production/HaufeCMS/Data/Div/Toolbox/RE/415/HI1496415>*
      *Line 17*
    * ...
    * Module None, line 232, in tbSyncMetadataSgmlJarHreDb
      *<TrustedFSPythonScript at
      /Production/HaufeCMS/tbSyncMetadataSgmlJarHreDb used for
      /Production/HaufeCMS/Data/Div/Toolbox/RE/415/HI1496415>*
      *Line 232*
    * Module None, line 37, in _checkout
      *<TrustedFSPythonScript at
      /Production/HaufeCMS/tbSyncMetadataSgmlJarHreDb used for
      /Production/HaufeCMS/Data/Div/Toolbox/RE/415/HI1496415>*
      *Line 37*
    * ...
    * Module None, line 4, in tbDoActionFor
      *<TrustedFSPythonScript at /Production/HaufeCMS/tbDoActionFor
      used for /Production/HaufeCMS/Data/Div/Toolbox/RE/415/HI1496415>*
      *Line 4*
    * Module Products.CMFCore.WorkflowTool, line 239, in doActionFor

 WorkflowException: No workflow provides the '${action_id}' action.

we use Zope 2.11.1-final, Python 2.4.4, CMFCore 2.1.2

Changed in zope-cmf:
status: New → Confirmed

Just to clarify: The issue affects the traceback rendering on the console. The substitution is not happening in this case.

mr_miles (miles-waller) wrote :

It also affects the rendering of the traceback on-screen, via the "standard_error_message" zpt template

I had a go at trying to fix this.

Basically, NO exception text is translated at the moment by the i18n machinery and standard_error_message - I can reproduce this problem for other exceptions in the workflow module. It seems that it does not work because the unicode representation comes from python's Exception class, and so does not expect translatable information - it basically munges all the arguments together.

I was able to fix the on-screen error message by defining a __unicode__ method on WorkflowException as follows:
def __unicode__(self):
   return self.args[0]

This then returns the Message object when rendering in a template, and so is translated normally.

However, the error_log coerces everything into strings, so translation isn't really possible without changing that to expect translatables, or at least carry out the string interpolation. As exceptions can have arbitrary arguments, this does not seem a sensible assumption.

It seems like a hack to me, and none of the other CMF exception texts are translated (grep for raise) other than those in the WorkflowTool - so I would propose changing these back to non-translatable exceptions to solve the issue. What do you think?

Campbell (campell) wrote :

Nobody should ever see this, so I can't imagine why it should be translated.

Products.CMFCore-2.2.5/Products/CMFCore/WorkflowTool.pyLine:235,
                msg = "No workflow provides the %s action." % action
                raise WorkflowException(msg)

is this comment like a pre-github pull request?

Tres Seaver (tseaver) wrote :

It can't be a "pull request" -- there is no patch / branch associated with it.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers