查看 Plone 自定义内容类型会产生 AttributeError: 'NoneType'对象没有属性“getPhysicalPath”;
在很多帮助下(我是一个缺乏经验的程序员/Plone 开发人员),我在新的 Plone 网站上创建了一些自定义内容类型。我现在遇到错误。内容类型称为“组织”,它有一个可选的多值引用字段,其中“允许类型”为“站点”(我的另一个自定义内容类型)。我创建了很多组织条目;一切都很好。然后我将其中一些链接到网站。他们保存正常,但现在,一两周后,当我尝试查看其中任何一个时,我收到此错误消息:
Traceback (innermost last):
Module ZPublisher.Publish, line 127, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 47, in call_object
Module Products.Five.browser.metaconfigure, line 477, in __call__
Module Products.Five.browser.pagetemplatefile, line 126, in __call__
Module Products.Five.browser.pagetemplatefile, line 60, in __call__
Module zope.pagetemplate.pagetemplate, line 113, in pt_render
Module zope.tal.talinterpreter, line 271, in __call__
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 888, in do_useMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 954, in do_defineSlot
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 858, in do_defineMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 954, in do_defineSlot
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 946, in do_defineSlot
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 858, in do_defineMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 888, in do_useMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 852, in do_condition
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 852, in do_condition
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 821, in do_loop_tal
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 583, in do_setLocal_tal
Module zope.tales.tales, line 696, in evaluate
URL: file:/usr/local/Plone/buildout-cache/eggs/archetypes.referencebrowserwidget-2.1-py2.6.egg/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.pt
Line 57, Column 12
Expression: <PythonExpr '/'.join(obj.getPhysicalPath())>
Names:
{'args': (),
'container': <Organisation at /ecn/what-we-do/about/sponsors/ccw>,
'context': <Organisation at /ecn/what-we-do/about/sponsors/ccw>,
'default': <object object at 0xb75f86d0>,
'here': <Organisation at /ecn/what-we-do/about/sponsors/ccw>,
'loop': {},
'nothing': None,
'options': {},
'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xcadb89c>,
'request': <HTTPRequest, URL=http://la-ecnweb1.nerc-lancaster.ac.uk:8080/ecn/what-we-do/about/sponsors/ccw/organisation_view>,
'root': <Application at >,
'template': <Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0xaa4154c>,
'traverse_subpath': [],
'user': <PropertiedUser 'admin'>,
'view': <Products.Five.metaclass.SimpleViewClass from /usr/local/Plone/zinstance/src/ceh.ecn_theme/ceh/ecn_theme/browser/templates/organisation_view.pt object at 0xc926aec>,
'views': <Products.Five.browser.pagetemplatefile.ViewMapper object at 0xc926aac>}
Module Products.PageTemplates.ZRPythonExpr, line 49, in __call__
__traceback_info__: '/'.join(obj.getPhysicalPath())
Module PythonExpr, line 1, in <expression>
AttributeError: 'NoneType' object has no attribute 'getPhysicalPath'
'Organizations' which don'参考网站显示效果很好。谁能建议可能是什么问题?我想知道这是否是索引问题,因此尝试更新 Portal_catalog、reference_catalog 和 uid_catalog 但这没有帮助。
奇怪的是,我创建了一个新的“组织”并将其链接到“站点”并且工作正常。另外,我在笔记本电脑上的 Plone 本地实例上测试了所有自定义类型和模板,一切正常。就好像这些特定的对象自第一次创建以来就已经被某些东西破坏了。
- 配置是: 克隆人4.0.3 佐普 2.12.14 Python 2.6.5(r265:79063,2010年8月13日,14:26:16)[GCC 4.2.4(Ubuntu 4.2.4-1ubuntu4)]
- 该网站位于:http://la-ecnweb1.nerc-lancaster.ac.uk:8080/ecn
- 问题内容类型之一是: http://la-ecnweb1 .nerc-lancaster.ac.uk:8080/ecn/what-we-do/about/sponsors/ccw
如果您需要我发布任何代码,请告知,我会做的。
谢谢。
With a lot of help (I'm a v. inexperienced programmer/Plone developer) I've created some custom content types on a new Plone website. I'm now experiencing an error. The content type is called 'Organisation' and it has an optional multi-value reference field with an 'allowed type' of 'site' (another of my custom content types). I created a whole lot of organisation entries; all fine. I then linked some of them to sites. They saved OK but now, a week or two later, when I try to view any of these I get this error message:
Traceback (innermost last):
Module ZPublisher.Publish, line 127, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 47, in call_object
Module Products.Five.browser.metaconfigure, line 477, in __call__
Module Products.Five.browser.pagetemplatefile, line 126, in __call__
Module Products.Five.browser.pagetemplatefile, line 60, in __call__
Module zope.pagetemplate.pagetemplate, line 113, in pt_render
Module zope.tal.talinterpreter, line 271, in __call__
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 888, in do_useMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 954, in do_defineSlot
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 858, in do_defineMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 954, in do_defineSlot
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 946, in do_defineSlot
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 858, in do_defineMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 888, in do_useMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 852, in do_condition
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 852, in do_condition
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 821, in do_loop_tal
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 583, in do_setLocal_tal
Module zope.tales.tales, line 696, in evaluate
URL: file:/usr/local/Plone/buildout-cache/eggs/archetypes.referencebrowserwidget-2.1-py2.6.egg/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.pt
Line 57, Column 12
Expression: <PythonExpr '/'.join(obj.getPhysicalPath())>
Names:
{'args': (),
'container': <Organisation at /ecn/what-we-do/about/sponsors/ccw>,
'context': <Organisation at /ecn/what-we-do/about/sponsors/ccw>,
'default': <object object at 0xb75f86d0>,
'here': <Organisation at /ecn/what-we-do/about/sponsors/ccw>,
'loop': {},
'nothing': None,
'options': {},
'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xcadb89c>,
'request': <HTTPRequest, URL=http://la-ecnweb1.nerc-lancaster.ac.uk:8080/ecn/what-we-do/about/sponsors/ccw/organisation_view>,
'root': <Application at >,
'template': <Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0xaa4154c>,
'traverse_subpath': [],
'user': <PropertiedUser 'admin'>,
'view': <Products.Five.metaclass.SimpleViewClass from /usr/local/Plone/zinstance/src/ceh.ecn_theme/ceh/ecn_theme/browser/templates/organisation_view.pt object at 0xc926aec>,
'views': <Products.Five.browser.pagetemplatefile.ViewMapper object at 0xc926aac>}
Module Products.PageTemplates.ZRPythonExpr, line 49, in __call__
__traceback_info__: '/'.join(obj.getPhysicalPath())
Module PythonExpr, line 1, in <expression>
AttributeError: 'NoneType' object has no attribute 'getPhysicalPath'
'Organisations' which don't make reference to a site display fine. Can anyone suggest what might be the problem? I wondered if it was an index problem so have tried updating portal_catalog, reference_catalog and uid_catalog but that hasn't helped.
Strangely, I've created a new 'Organisation' and linked it to a 'Site' and it works fine. Also, I tested all my custom types and templates on a local instance of Plone on my laptop and it all works fine there. It's as if something has corrupted these particular objects since they were first created.
- The configuration is:
Plone 4.0.3
Zope 2.12.14
Python 2.6.5 (r265:79063, Aug 13 2010, 14:26:16) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu4)] - The site is here: http://la-ecnweb1.nerc-lancaster.ac.uk:8080/ecn
- One of the problem content types is:
http://la-ecnweb1.nerc-lancaster.ac.uk:8080/ecn/what-we-do/about/sponsors/ccw
Please advise if you need me to post any code and I will do.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有类似的问题:当引用的页面被取消时,“引用系统”中的某些内容似乎不起作用。该页面被标记为未公开
覆盖referencebrowser.pt将行从164更改为172解决了我
在archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.pt中的问题
Had similar problem: it seems something didn't work in "references system" when a referenced page was cancelled. The page was marked as Undisclosed
Overriding referencebrowser.pt changing line from 164 to 172 solves my problem
in archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.pt
如果您以某种绕过用于更新引用的机制的方式移动组织,或者该机制以某种方式损坏,那么这就可以解释问题。我认为清除reference_catalog和uid_catalog,然后“清除并重建”portal_catalog可能会解决您的问题。您会在 Portal_catalog 的 ZMI 中同一页面中间的“更新目录”下方找到该按钮。 “更新目录”过程假设目录已经正确知道要索引的所有对象的位置,但这正是这里的问题,一个或多个目录尚未保持有关“站点”位置的最新信息。这就是“清除并重建”的用武之地。从 ZMI 中该页面上的文档来看:
如果这不起作用,或者如果您只是好奇,则必须找出导致问题的引用。找到一个有错误的“组织”示例,使用“bin/instance debug”之类的内容启动调试器,然后执行以下操作:
这应该打印出目录所涉及的路径列表认为站点位于。您可以检查它并了解更多正在发生的事情。您还可以进一步查看“损坏”和“大脑”列表中的内容,以了解更多正在发生的事情。
If you moved the organizations in some way that bypassed the machinery used to update references or if that machinery was somehow broken, then that would explain the troubles. I think clearing the reference_catalog and uid_catalog followed by a "Clear and Rebuild" of the portal_catalog will probably address your issue. You'll find that button below the "Update Catalog" toward the middle of that same page in the ZMI of the portal_catalog. The "Update Catalog" process assumes the catalog already correctly knows where all the objects to be indexed are, but that's exactly the problem here, one or more of the catalogs has not been kept up to date on where your "Site"s are. That's where "Clear and Rebuild" comes in. From the docs on that page in the ZMI:
If that doesn't work, or if you're just curious, you'll have to find out which reference is causing the problem. Find an example "Organization" with the error, start the debugger with something like "bin/instance debug", then do something like:
That should print out a list of the paths which the catalog involved thinks the sites are at. You can inspect that and see more of what's going on. You can also poke more around what's in the "broken" and "brains" lists to see more of what's going on.
看起来引用的对象已经不存在了。它无法通过 UUID 查找,因此 reference_catalog 中的某个位置没有返回 (_objectByUUID)。
我认为 archetypes.referencebrowserwidget 应该处理这种情况,但事实并非如此。
您还记得您引用了哪个网站吗?还在吗?
您是否能够以某种方式删除引用并重新创建它?
干杯
It seems like the referenced object is not there anymore. It cannot be looked up by UUID, so somewhere in the reference_catalog None is returned (_objectByUUID).
I think archetypes.referencebrowserwidget should handle this case, but it does not.
Do you remember which site you referenced? Is it still there?
Are you able to somehow drop the reference and recreate it?
Cheers