Python 如何在plone中编辑使用uwosh.pfg.d2c适配器保存的数据条目?

Python 如何在plone中编辑使用uwosh.pfg.d2c适配器保存的数据条目?,python,plone,ploneformgen,Python,Plone,Ploneformgen,我已经使用ploneformgen创建了输入表单。 当我尝试使用“编辑”选项卡在表单中使用uwosk.pfg.d2c适配器编辑保存的数据条目时,出现以下错误: <FSControllerPythonScript at /MySite/update_version_on_edit used for /MySite/materials-requirement/material-requirement-form/requirement-for-approval/trial> Lin

我已经使用ploneformgen创建了输入表单。 当我尝试使用“编辑”选项卡在表单中使用uwosk.pfg.d2c适配器编辑保存的数据条目时,出现以下错误:

<FSControllerPythonScript at /MySite/update_version_on_edit used for /MySite/materials-requirement/material-requirement-form/requirement-for-approval/trial>
    Line 11
    Module Products.CMFEditions.utilities, line 109, in isObjectChanged
    Module Products.CMFEditions.CopyModifyMergeRepositoryTool, line 415, in isUpToDate
    Module Products.CMFEditions.ArchivistTool, line 396, in isUpToDate
    Module Products.CMFEditions.ZVCStorageTool, line 308, in getModificationDate
    Module Products.Archetypes.ExtensibleMetadata, line 455, in modified
    Module Products.Archetypes.BaseObject, line 237, in getField
    Module Products.Archetypes.BaseObject, line 821, in Schema
    Module zope.component.hooks, line 104, in adapter_hook
    Module archetypes.schemaextender.extender, line 146, in cachingInstanceSchemaFactory
    Module archetypes.schemaextender.extender, line 186, in instanceSchemaFactory
    Module plone.memoize.instance, line 51, in memogetter
    Module uwosh.pfg.d2c.extender, line 217, in getFields
    Module uwosh.pfg.d2c.content.dataentry, line 39, in getForm
    Module uwosh.pfg.d2c.content.dataentry, line 53, in getFormAdapter
    Module Products.CMFCore.utils, line 123, in getToolByName
    AttributeError: uid_catalog

第11行
模块Products.CMFEditions.utilities,第109行,已更改
模块Products.CMFEditions.CopyModifyMergeRepositoryTool,第415行,在IsUpdate中
模块产品.CMF条件.Archivistool,第396行,在IsUpdate中
getModificationDate中的模块Products.CMFEditions.ZVCStorageTool,第308行
模块Products.Archetypes.ExtensionableMetadata,第455行,已修改
getField中第237行的模块Products.Archetypes.BaseObject
模式中的模块Products.Archetypes.BaseObject,第821行
模块zope.component.hooks,第104行,在适配器_hook中
cachingInstanceSchemaFactory中模块archetypes.schemaextender.extender,第146行
instanceSchemaFactory中模块archetypes.SchemaXtender.extender,第186行
memogetter中第51行的plone.memoize.instance模块
getFields中第217行的模块uwosh.pfg.d2c.extender
模块uwosh.pfg.d2c.content.dataentry,第39行,getForm格式
getFormAdapter中第53行的模块uwosh.pfg.d2c.content.dataentry
getToolByName中模块Products.CMFCore.utils,第123行
AttributeError:uid\u目录

如何修复此错误。在使用GUI或ZMI时,我需要这些步骤。我使用plone 4.1、ploneformgen 1.7.1和d2c适配器2.1.5,看起来该产品在与CMF条件结合使用时出现故障。尝试编辑
uwosh.pfg.d2c.content.dataentry
以在顶部添加导入,然后更改第53行以通过不同的路径访问
uid\u目录

您需要首先找到该文件;在
bin/instance
脚本中搜索
uwosh.pfg.d2c
。这会告诉你鸡蛋的位置。在egg中,找到文件
uwosh/pfg/d2c/content/dataentry.py
,并在编辑器中打开它

在顶部,使用其他
import
语句添加以下行:

from zope.app.component.hooks import getSite
修改第54行(是第53行,但在顶部添加了一行);它现在是这样写的:

catalog = getToolByName(self, 'uid_catalog')
self
更改为
getSite()
以使其可读:

catalog = getToolByName(getSite(), 'uid_catalog')
以这种方式改变鸡蛋是不可携带的;对于站点的每个安装,您都必须这样做。如果上述修改对您有效,请将其报告给软件包的作者,以便在新版本中修复

目前包中存在一个似乎相关的问题,请参阅,您可以在哪里对此进行跟进。或者,你也可以在新的登记簿上登记


是的,包作者Nathan van Gheem也经常出现堆栈溢出,但你不应该指望他会发现这里的问题。将问题提交到支持的位置意味着更多的人可以找到它并提供帮助

@vangheem我非常需要它。请帮忙。我剪了一个新版本来解决这个问题。