[Erp5-dev] Hardcoded workflow_id in ZODB scripts are problematic...aren't they?

Jérome Perrin jerome at nexedi.com
Fri Oct 26 18:35:39 CEST 2007


Łukasz Nowak a écrit :
> Hello,
> 
> I've managed transition from original workflow names (eg.
> accounting_workflow) to our own workflow names (eg.
> ventis_accounting_workflow).
> 
> What I found right now is that there are many places, where workflow_id
> is hardcoded, using such grep from fetched Nexedi's BT:
> 
> find . -type f | grep -v \\.svn | xargs grep wf_id
> 
> Right now I'm putting hardcoded our workflow id, but isn't it a
> problem? I know, it might be sometimes quite hard do dynamically fetch
> workflow id from some context (eg. to choose simulation state on report
> dialog).

Hello,

I grepped in erp5_accounting, and saw two uses of wf_id:

  1) portal_workflow.doActionFor(wf_id=... as far as I know, this is not 
needed, and should be removed because it cause problems anytime a 
workflow is renamed.

  2) Base_getTranslatedWorkflowStateItemList(wf_id=... This is mostly 
used in reports dialogs. Very soon we'll have a field library for report 
dialogs and you'll have only one field to customize.
For now, it's possible to customize this script (in a very ad hoc way).

Better, we could make a script that will be workflow name independant, 
like this:
   Base_getTranslatedWorkflowStateItemList(
                  state_variable_name='simulation_state')
I'm not sure it will be possible to get the info from restricted 
environment.

Jérome



More information about the Erp5-dev mailing list