Plone ReferenceField导致AttributeError:';功能';对象没有属性'__的&';在自定义内容类型中
我创建了一个自定义内容类型,该类型具有ReferenceField。当我将allowed_类型设置为默认内容类型(如文档或文件夹)时,在保存或重新编制索引时不会出现任何问题。然而,当我将allowed_类型设置为另一个自定义内容类型时,我得到了一个非常奇怪的错误。看起来我可以在ReferenceField fine中设置UID,并且基本视图不会中断,但我无法保存或重新索引对象 使用: Plone 4.0.1 Zope 2.12.11 Python 2.6.5(r265:79063,2010年11月21日,11:58:21)[GCC 4.2.1(Apple Inc.build 5664)] 有什么想法吗Plone ReferenceField导致AttributeError:';功能';对象没有属性'__的&';在自定义内容类型中,plone,Plone,我创建了一个自定义内容类型,该类型具有ReferenceField。当我将allowed_类型设置为默认内容类型(如文档或文件夹)时,在保存或重新编制索引时不会出现任何问题。然而,当我将allowed_类型设置为另一个自定义内容类型时,我得到了一个非常奇怪的错误。看起来我可以在ReferenceField fine中设置UID,并且基本视图不会中断,但我无法保存或重新索引对象 使用: Plone 4.0.1 Zope 2.12.11 Python 2.6.5(r265:79063,2010年11
atapi.ReferenceField(
'issue_source',
storage=atapi.AnnotationStorage(),
widget=atapi.ReferenceWidget(
label=_(u"Issue Source"),
description=_(u"Please select the source document to which this issue corresponds."),
),
required=True,
relationship='issue_issue_source',
allowed_types=('Source Document'), # specify portal type names here ('Example Type',)
multiValued=False, #One to One relationship
),
在ipzope中:
>>> issue
<Issue at /Plone/Members/test_user2/test-issue>
>>> issue.isReferenceable
1
>>> source_document
<SourceDocument at /Plone/test-folder/test-doc>
>>> issue.setIssue_source(source_document.UID())
>>> issue.getIssue_source()
<SourceDocument at /Plone/test-folder/test-doc>
>>> source_document
<SourceDocument at /Plone/test-folder/test-doc>
>>> issue.reindexObject()
> /Applications/Plone/plone-site/eggs/Products.CMFDynamicViewFTI-4.0-py2.6.egg/Products/CMFDynamicViewFTI/browserdefault.py(77)__call__()
76 context = aq_inner(self)
---> 77 template = template.__of__(context)
78 return template(context, context.REQUEST)
ipdb> quit
------------------------------------------------------------
Traceback (most recent call last):
File "<ipython console>", line 1, in <module>
File "/Applications/Plone/plone-site/eggs/Products.Archetypes-1.6.3-py2.6.egg/Products/Archetypes/CatalogMultiplex.py", line 123, in reindexObject
c.catalog_object(self, url, idxs=lst)
File "/Applications/Plone/plone-site/eggs/Plone-4.0.1-py2.6.egg/Products/CMFPlone/CatalogTool.py", line 287, in catalog_object
update_metadata, pghandler=pghandler)
File "/Applications/Plone/plone-site/eggs/Products.PDBDebugMode-1.3.1-py2.6.egg/Products/PDBDebugMode/zcatalog.py", line 20, in catalog_object
update_metadata=update_metadata, pghandler=pghandler)
File "/Applications/Plone/plone-site/eggs/Zope2-2.12.11-py2.6-macosx-10.4-x86_64.egg/Products/ZCatalog/ZCatalog.py", line 529, in catalog_object
update_metadata=update_metadata)
File "/Applications/Plone/plone-site/eggs/Zope2-2.12.11-py2.6-macosx-10.4-x86_64.egg/Products/ZCatalog/Catalog.py", line 348, in catalogObject
self.updateMetadata(object, uid)
File "/Applications/Plone/plone-site/eggs/Zope2-2.12.11-py2.6-macosx-10.4-x86_64.egg/Products/ZCatalog/Catalog.py", line 278, in updateMetadata
newDataRecord = self.recordify(object)
File "/Applications/Plone/plone-site/eggs/Zope2-2.12.11-py2.6-macosx-10.4-x86_64.egg/Products/ZCatalog/Catalog.py", line 417, in recordify
if(attr is not MV and safe_callable(attr)): attr=attr()
File "/Applications/Plone/plone-site/eggs/Products.CMFDynamicViewFTI-4.0-py2.6.egg/Products/CMFDynamicViewFTI/browserdefault.py", line 77, in __call__
template = template.__of__(context)
AttributeError: 'function' object has no attribute '__of__'
>问题
>>>issue.isReferenceable
1.
>>>源文件
>>>issue.setIssue\u源(source\u document.UID())
>>>issue.getIssue_source()
>>>源文件
>>>issue.reindexObject()
>/Applications/Plone/Plone-site/eggs/Products.CMFDynamicViewFTI-4.0-py2.6.egg/Products/CMFDynamicViewFTI/browserdefault.py(77)\调用
76上下文=aq_内部(自身)
--->77模板=模板。模板中的模板(上下文)
78返回模板(上下文,context.REQUEST)
ipdb>退出
------------------------------------------------------------
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
reindexObject中的文件“/Applications/Plone/Plone site/eggs/Products.Archetypes-1.6.3-py2.6.egg/Products/Archetypes/CatalogMultiplex.py”,第123行
c、 catalog_对象(self、url、idxs=lst)
文件“/Applications/Plone/Plone-site/eggs/Plone-4.0.1-py2.6.egg/Products/CMFPlone/CatalogTool.py”,第287行,在catalog_对象中
更新_元数据,pghandler=pghandler)
目录对象中的文件“/Applications/Plone/Plone site/eggs/Products.PDBDebugMode-1.3.1-py2.6.egg/Products/PDBDebugMode/zcatalog.py”,第20行
更新\元数据=更新\元数据,pghandler=pghandler)
目录对象中的文件“/Applications/Plone/Plone site/eggs/Zope2-2.12.11-py2.6-macosx-10.4-x86_64.egg/Products/ZCatalog/ZCatalog.py”,第529行
更新\元数据=更新\元数据)
catalogObject中的文件“/Applications/Plone/Plone site/eggs/Zope2-2.12.11-py2.6-macosx-10.4-x86_64.egg/Products/ZCatalog/Catalog.py”,第348行
self.updateMetadata(对象,uid)
updateMetadata中的文件“/Applications/Plone/Plone site/eggs/Zope2-2.12.11-py2.6-macosx-10.4-x86_64.egg/Products/ZCatalog/Catalog.py”,第278行
newDataRecord=self.recordify(对象)
recordify中的文件“/Applications/Plone/Plone site/eggs/Zope2-2.12.11-py2.6-macosx-10.4-x86_64.egg/Products/ZCatalog/Catalog.py”,第417行
如果(attr不是MV且可安全调用(attr)):attr=attr()
文件“/Applications/Plone/Plone site/eggs/Products.CMFDynamicViewFTI-4.0-py2.6.egg/Products/CMFDynamicViewFTI/browserdefault.py”,第77行,in\uu调用__
模板=模板。uuuu的uuu(上下文)
AttributeError:“函数”对象没有属性“\uuuu of\uuu”
当我单击“通过web保存”时,会收到一条稍有不同的错误消息:
2011-08-09 15:19:16 ERROR Zope.SiteErrorLog 1312895956.510.252592718824 http://127.0.0.1:8080/Plone/Members/test_user2/test-doc/atct_edit
Traceback (innermost last):
Module ZPublisher.Publish, line 127, in publish
Module ZPublisher.mapply, line 77, in mapply
Module Products.PDBDebugMode.runcall, line 70, in pdb_runcall
Module ZPublisher.Publish, line 47, in call_object
Module Products.CMFFormController.FSControllerPageTemplate, line 91, in __call__
Module Products.CMFFormController.BaseControllerPageTemplate, line 28, in _call
Module Products.CMFFormController.ControllerBase, line 231, in getNext
Module Products.CMFFormController.Actions.TraverseTo, line 38, in __call__
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 47, in call_object
Module Products.CMFFormController.FSControllerPythonScript, line 107, in __call__
Module Products.CMFFormController.ControllerBase, line 231, in getNext
Module Products.CMFFormController.Actions.TraverseTo, line 38, in __call__
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 47, in call_object
Module Products.CMFFormController.FSControllerPythonScript, line 105, in __call__
Module Products.CMFFormController.Script, line 145, in __call__
Module Products.CMFCore.FSPythonScript, line 130, in __call__
Module Shared.DC.Scripts.Bindings, line 324, in __call__
Module Shared.DC.Scripts.Bindings, line 361, in _bindAndExec
Module Products.PythonScripts.PythonScript, line 344, in _exec
Module script, line 1, in content_edit
- <FSControllerPythonScript at /Plone/content_edit used for /Plone/Members/test_user2/test-doc>
- Line 1
Module Products.CMFCore.FSPythonScript, line 130, in __call__
Module Shared.DC.Scripts.Bindings, line 324, in __call__
Module Shared.DC.Scripts.Bindings, line 361, in _bindAndExec
Module Products.PythonScripts.PythonScript, line 344, in _exec
Module script, line 13, in content_edit_impl
- <FSPythonScript at /Plone/content_edit_impl used for /Plone/Members/test_user2/test-doc>
- Line 13
Module Products.Archetypes.BaseObject, line 658, in processForm
Module Products.Archetypes.BaseObject, line 650, in _processForm
- __traceback_info__: (<Issue at /Plone/Members/test_user2/test-doc>, <Field nextPreviousEnabled(boolean:rw)>, <bound method Issue.setNextPreviousEnabled of <Issue at /Plone/Members/test_user2/test-doc>>)
Module Products.Archetypes.CatalogMultiplex, line 123, in reindexObject
Module Products.CMFPlone.CatalogTool, line 287, in catalog_object
Module Products.PDBDebugMode.zcatalog, line 20, in catalog_object
Module Products.ZCatalog.ZCatalog, line 529, in catalog_object
Module Products.ZCatalog.Catalog, line 348, in catalogObject
Module Products.ZCatalog.Catalog, line 278, in updateMetadata
Module Products.ZCatalog.Catalog, line 417, in recordify
Module Products.CMFDynamicViewFTI.browserdefault, line 77, in __call__
AttributeError: 'function' object has no attribute '__of__'
> /Applications/Plone/plone-site/eggs/Products.CMFDynamicViewFTI-4.0-py2.6.egg/Products/CMFDynamicViewFTI/browserdefault.py(77)__call__()
76 context = aq_inner(self)
---> 77 template = template.__of__(context)
78 return template(context, context.REQUEST)
2011-08-09 15:19:16错误Zope.SiteErrorLog 1312895956.510.252592718824http://127.0.0.1:8080/Plone/Members/test_user2/test-doc/atct\U编辑
回溯(最里面的最后一个):
发布中模块ZPublisher.Publish,第127行
模块ZPublisher.mapply,第77行,在mapply中
pdb_runcall中第70行的模块Products.PDBDebugMode.runcall
模块ZPublisher.Publish,第47行,在call_对象中
模块Products.CMFFormController.FSControllerPageTemplate,第91行,输入调用__
模块Products.CMFFormController.BaseControllerPageTemplate,第28行,in\U调用
getNext中的模块Products.CMFFormController.ControllerBase,第231行
模块Products.CMFFormController.Actions.TraverseTo,第38行,输入调用__
模块ZPublisher.mapply,第77行,在mapply中
模块ZPublisher.Publish,第47行,在call_对象中
Module Products.CMFFormController.FSControllerPythonScript,第107行,在调用中__
getNext中的模块Products.CMFFormController.ControllerBase,第231行
模块Products.CMFFormController.Actions.TraverseTo,第38行,输入调用__
模块ZPublisher.mapply,第77行,在mapply中
模块ZPublisher.Publish,第47行,在call_对象中
模块Products.CMFFormController.FSControllerPythonScript,第105行,在调用中__
模块Products.CMFFormController.Script,第145行,在调用中__
模块Products.CMFCore.FSPythonScript,第130行,in__调用__
模块Shared.DC.Scripts.Bindings,第324行,在调用中__
模块Shared.DC.Scripts.Bindings,第361行,在_bindAndExec中
模块产品.PythonScripts.PythonScript,第344行,in_exec
内容编辑中的模块脚本第1行
-
-第1行
模块Products.CMFCore.FSPythonScript,第130行,in__调用__
模块Shared.DC.Scripts.Bindings,第324行,在调用中__
模块Shared.DC.Scripts.Bindings,第361行,在_bindAndExec中
模块产品.PythonScripts.PythonScript,第344行,in_exec
模块脚本,第13行,在内容\u编辑\u impl中
-
-第13行
processForm中的模块Products.Archetypes.BaseObject,第658行
模块Products.Archetypes.BaseObject,第650行,以流程形式
-_u回溯_;信息__;:(,)
reindexObject中模块Products.Archetypes.CatalogMultiplex,第123行
catalog_对象中的模块Products.CMFPlone.CatalogTool,第287行
catalog_对象中的模块Products.PDBDebugMode.zcatalog,第20行
目录_对象中的模块Products.ZCatalog.ZCatalog,第529行
catalogObject中的模块Products.ZCatalog.Catalog,第348行
updateMetadata中的模块Products.ZCatalog.Catalog,第278行
recordify中模块Products.ZCatalog.Catalog,第417行
Module Products.CMFDynamicViewFTI.browserdefault,第77行,输入调用__
AttributeError:“函数”对象没有属性“\uuuu of\uuu”
>/Applications/Plone/Plone-site/eggs/Products.CMFDynamicViewFTI-4.0-py2.6.egg/Products/CMFDynamicViewFTI/browserdefault.py(77)\调用
76上下文=aq_内部(自身)
--->77模板=模板。模板中的模板(上下文)
78返回模板(上下文,context.REQUEST)
这看起来确实很奇怪,有一些提示:
allowed_types=('Source Document', ),
query = {'UID': uids}
brains = catalog(query)