Commit f3bf5a7e authored by wenjie.zheng's avatar wenjie.zheng

erp5_core: ERP5Site_updateTranslationTable speed up by replacing accesors with...

erp5_core: ERP5Site_updateTranslationTable speed up by replacing accesors with variable as much as possible.
parent 30973c35
......@@ -72,16 +72,18 @@ def catalog_translation_list(object_list):\n
object_list = []\n
portal_workflow = context.portal_workflow\n
portal_type_list = context.portal_types.objectValues()\n
\n
chain_dict = portal_workflow.getChainDict()\n
for wf in portal_workflow.objectValues():\n
if wf is None:\n
continue\n
wf_id = wf.getId()\n
state_var = wf.getStateVariable()\n
if wf.getStateValueList():\n
for state_id, state in wf.getStateValueList().items():\n
state_value_list = wf.getStateValueList().items()\n
for state_id, state in state_value_list:\n
for lang in supported_languages:\n
for portal_type in portal_type_list:\n
if wf.getId() not in portal_type.getTypeWorkflowList() and portal_type.getId() not in getattr(portal_workflow.getChainDict(), wf.getId(),[]):\n
if wf_id not in portal_type.getTypeWorkflowList() and portal_type.getId() not in getattr(chain_dict, wf_id,[]):\n
# do not check unrelated portal type.\n
continue\n
key = (lang, portal_type, state_var, state_id)\n
......@@ -94,7 +96,7 @@ for wf in portal_workflow.objectValues():\n
# translate state title as well\n
if state.title != \'\' :\n
state_var_title = \'%s_title\' % state_var\n
msg_id = getMessageIdWithContext(state.title, \'state\', wf.id)\n
msg_id = getMessageIdWithContext(state.title, \'state\', wf_id)\n
translated_message = context.Localizer.erp5_ui.gettext(msg_id, default=\'\', lang=lang).encode(\'utf-8\')\n
if translated_message == \'\':\n
msg_id = state.title\n
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment