Discussion:
[Erp5-dev] Hardcoded workflow_id in ZODB scripts are problematic...aren't they?
Łukasz Nowak
2007-10-26 14:48:01 UTC
Permalink
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).

Is it known bug/feature/unresolved problem?

Regards,
Luke
--
?ukasz Nowak R&D Ventis http://www.ventis.com.pl/
tel: +48 32 768 16 85 fax: +48 32 392 10 61
``Use the Source, Luke...'' I am only craftsman.
Jérome Perrin
2007-10-26 16:35:39 UTC
Permalink
Post by Łukasz Nowak
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
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
Yoshinori Okuji
2007-10-30 02:44:06 UTC
Permalink
Post by Łukasz Nowak
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
find . -type f | grep -v \\.svn | xargs grep wf_id
A faster way: grep -r --include="*.xml" wf_id .
Post by Łukasz Nowak
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).
Is it known bug/feature/unresolved problem?
Most probably, they are wrong. However, they are also difficult to fix cleanly
in the current implementation. One day, when we start to use interfaces
appropriately, this would be solved.

YO
--
Yoshinori Okuji, Nexedi CTO
Nexedi: Consulting and Development of Free / Open Source Software
http://www.nexedi.com
ERP5: Full Featured High End Open Source ERP
http://www.erp5.com
ERP5 Wiki: Developer Zone for ERP5 Community
http://www.erp5.org
Loading...