在多语言站点中更改工作流仅适用于一种语言 [英] Changing workflow in multilingual site works only for one language

查看:77
本文介绍了在多语言站点中更改工作流仅适用于一种语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个全新的Plone-4.1.5站点,安装了Linguaplone-4.1.1,选择了两种语言,并将首页翻译成另一种语言.

I have a fresh Plone-4.1.5-site with Linguaplone-4.1.1 installed, two languages selected and the front-page translated into the other language.

通过控制面板将工作流程从simple_workflow更改为intranet_workflow并将旧状态映射到新状态时,只会发生当前选择语言的对象获得新映射的情况.其他语言的对象将获得新工作流程的初始状态.

When changing the workflow from simple_workflow to intranet_workflow via the controlpanel, and mapping old states to new ones, it occurs, that only objects of the current chosen language get the new mapping. Objects of the other language get the initial state of the new workflow.

是否可以通过编程方式进行映射以克服这一问题?

Is it possible to do the mapping programatically to overcome this?

推荐答案

在这种情况下,仅修补重新映射工作流程的代码可能最简单.

In this case, it'll probably be simplest to just patch the code that remaps the workflows.

打开plone.app.workflow鸡蛋(其路径将在bin/instance脚本中列出),找到plone/app/workflow/remap.py文件并进行编辑.

Open the plone.app.workflow egg (it's path will be listed in your bin/instance script), find the plone/app/workflow/remap.py file and edit it.

大约一半,您会发现以下行(我的副本中的第79行):

About halfway down you'll find the following line (line 79 in my copy):

for brain in portal_catalog(portal_type=type_ids):

并在其中添加Language='all'

for brain in portal_catalog(portal_type=type_ids, Language='all'):

另一种方法是将整个文件复制到您自己的项目中,在本地进行更改,然后使用以下命令进行调用:

The alternative is copying that whole file into your own project, make that change locally, then calling it with:

statemap = {
    'oldstate1_id': 'newstate1_id',
    'oldstate2_id': 'newstate2_id'
}
chain_name = ('workflow_id',)  # tuple of wf ids (can be empty), or the string '(Default)'
portal_types = ('sequence', 'of', 'portal_types')

copiedremap.remap_workflow(portal, portal_types, chain_name, state_map)

然后,remap_workflow脚本使用对象的 current 状态来查找对象在新的目标工作流程中应具有的新状态(它将对每个新工作流程执行此操作) ;如果旧状态未在地图中列出,它将使用目标工作流程的初始状态.

The remap_workflow script then uses the current state of the object to find the new state it should have in the new target workflow(s) (it'll do this for each new workflow); if the old state is not listed in the map it'll use the initial state of the target workflow.

这篇关于在多语言站点中更改工作流仅适用于一种语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆