在Plone 4.1.4中渲染404页面时“未找到”网站错误

时间:2012-10-04 20:31:49

标签: plone zope buildout diazo

问题: 每当用户导航到错误页面时,都不会显示“找不到页面”'如果在plone中显示消息,则会显示此zope错误消息:

NotFound('  <h2>Site Error</h2>\n  <p>An error was encountered while publishing this resource.\n  </p>\n  <p><strong>Resource not found</strong></p>\n\n  Sorry, the requested resource does not exist.<p>Check the URL and try again.</p><p><b>Resource:</b> http://www.caseware.com/ddddd</p>\n  <hr noshade="noshade"/>\n\n  <p>Troubleshooting Suggestions</p>\n\n  <ul>\n  <li>The URL may be incorrect.</li>\n  <li>The parameters passed to this resource may be incorrect.</li>\n  <li>A resource that this resource relies on may be\n      encountering an error.</li>\n  </ul>\n\n  <p>For more detailed information about the error, please\n  refer to the error log.\n  </p>\n\n  <p>If the error persists please contact the site maintainer.\n  Thank you for your patience.\n  </p>',) (Also, the following error occurred while attempting to render the standard error message, please see the event log for full details: )

同时,发生错误的实例的日志文件显示以下堆栈跟踪:

2012-10-03T13:12:06 ERROR root Exception while rendering an error message
Traceback (most recent call last):
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/OFS/SimpleItem.py", line 242, in raise_standardErrorMessage
    v = s(**kwargs)
File "/home/alex/projects/production/plone4_dev/eggs/Products.CMFCore-2.2.5-py2.6.egg/Products/CMFCore/FSPythonScript.py", line 130, in __call__
    return Script.__call__(self, *args, **kw)
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Shared/DC/Scripts/Bindings.py", line 322, in __call__
    return self._bindAndExec(args, kw, None)
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Shared/DC/Scripts/Bindings.py", line 359, in _bindAndExec
    return self._exec(bound_data, args, kw)
File "/home/alex/projects/production/plone4_dev/eggs/Products.PythonScripts-2.13.0-py2.6.egg/Products/PythonScripts/PythonScript.py", line 344, in _exec
    result = f(*args, **kw)
File "Script (Python)", line 34, in standard_error_message
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Shared/DC/Scripts/Bindings.py", line 322, in __call__
    return self._bindAndExec(args, kw, None)
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Shared/DC/Scripts/Bindings.py", line 359, in _bindAndExec
    return self._exec(bound_data, args, kw)
File "/home/alex/projects/production/plone4_dev/eggs/Products.CMFCore-2.2.5-py2.6.egg/Products/CMFCore/FSPageTemplate.py", line 240, in _exec
    result = self.pt_render(extra_context=bound_names)
File "/home/alex/projects/production/plone4_dev/eggs/Products.CMFCore-2.2.5-py2.6.egg/Products/CMFCore/FSPageTemplate.py", line 180, in pt_render
    self, source, extra_context
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Products/PageTemplates/PageTemplate.py", line 79, in pt_render
    showtal=showtal)
File "/home/alex/projects/production/plone4_dev/eggs/zope.pagetemplate-3.5.2-py2.6.egg/zope/pagetemplate/pagetemplate.py", line 113, in pt_render
    strictinsert=0, sourceAnnotations=sourceAnnotations)()
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 271, in __call__
    self.interpret(self.program)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 888, in do_useMacro
    self.interpret(macro)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 533, in do_optTag_tal
    self.do_optTag(stuff)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 518, in do_optTag
    return self.no_tag(start, program)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 513, in no_tag
    self.interpret(program)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 531, in do_optTag_tal
    self.no_tag(stuff[-2], stuff[-1])
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 513, in no_tag
    self.interpret(program)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 742, in do_insertStructure_tal
    structure = self.engine.evaluateStructure(expr)
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Products/PageTemplates/Expressions.py", line 218, in evaluateStructure
    text = super(ZopeContext, self).evaluateStructure(expr)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tales-3.5.1-py2.6.egg/zope/tales/tales.py", line 696, in evaluate
    return expression(self)
File "/home/alex/projects/production/plone4_dev/eggs/zope.contentprovider-3.7.2-py2.6.egg/zope/contentprovider/tales.py", line 80, in __call__
    return provider.render()
File "/home/alex/projects/production/plone4_dev/eggs/plone.app.viewletmanager-2.0.2-py2.6.egg/plone/app/viewletmanager/manager.py", line 85, in render
    return u'\n'.join([viewlet.render() for viewlet in self.viewlets])
File "/home/alex/projects/production/plone4_dev/eggs/zope.browserpage-3.12.2-py2.6.egg/zope/browserpage/simpleviewclass.py", line 44, in __call__
    return self.index(*args, **kw)
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Products/Five/browser/pagetemplatefile.py", line 125, in __call__
    return self.im_func(im_self, *args, **kw)
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Products/Five/browser/pagetemplatefile.py", line 59, in __call__
    sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
File "/home/alex/projects/production/plone4_dev/eggs/zope.pagetemplate-3.5.2-py2.6.egg/zope/pagetemplate/pagetemplate.py", line 113, in pt_render
    strictinsert=0, sourceAnnotations=sourceAnnotations)()
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 271, in __call__
    self.interpret(self.program)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 533, in do_optTag_tal
    self.do_optTag(stuff)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 518, in do_optTag
    return self.no_tag(start, program)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 513, in no_tag
    self.interpret(program)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 531, in do_optTag_tal
    self.no_tag(stuff[-2], stuff[-1])
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 513, in no_tag
    self.interpret(program)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 742, in do_insertStructure_tal
    structure = self.engine.evaluateStructure(expr)
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Products/PageTemplates/Expressions.py", line 218, in evaluateStructure
    text = super(ZopeContext, self).evaluateStructure(expr)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tales-3.5.1-py2.6.egg/zope/tales/tales.py", line 696, in evaluate
    return expression(self)
File "/home/alex/projects/production/plone4_dev/eggs/zope.contentprovider-3.7.2-py2.6.egg/zope/contentprovider/tales.py", line 80, in __call__
    return provider.render()
File "/home/alex/projects/production/plone4_dev/eggs/zope.viewlet-3.7.2-py2.6.egg/zope/viewlet/manager.py", line 124, in render
    return self.template(viewlets=self.viewlets)
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Products/Five/browser/pagetemplatefile.py", line 125, in __call__
    return self.im_func(im_self, *args, **kw)
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Products/Five/browser/pagetemplatefile.py", line 59, in __call__
    sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
File "/home/alex/projects/production/plone4_dev/eggs/zope.pagetemplate-3.5.2-py2.6.egg/zope/pagetemplate/pagetemplate.py", line 113, in pt_render
    strictinsert=0, sourceAnnotations=sourceAnnotations)()
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 271, in __call__
    self.interpret(self.program)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 819, in do_loop_tal
    iterator = self.engine.setRepeat(name, expr)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tales-3.5.1-py2.6.egg/zope/tales/tales.py", line 682, in setRepeat
    expr = self.evaluate(expr)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tales-3.5.1-py2.6.egg/zope/tales/tales.py", line 696, in evaluate
    return expression(self)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tales-3.5.1-py2.6.egg/zope/tales/expressions.py", line 217, in __call__
    return self._eval(econtext)
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Products/PageTemplates/Expressions.py", line 155, in _eval
    return render(ob, econtext.vars)
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Products/PageTemplates/Expressions.py", line 117, in render
    ob = ob()
File "/home/alex/projects/production/plone4_dev/eggs/Products.ResourceRegistries-2.0.6-py2.6.egg/Products/ResourceRegistries/browser/scripts.py", line 27, in scripts
    content = registry.getInlineResource(script.getId(), context)
File "/home/alex/projects/production/plone4_dev/eggs/Products.ResourceRegistries-2.0.6-py2.6.egg/Products/ResourceRegistries/tools/BaseRegistry.py", line 856, in getInlineResource
    output = self.getResourceContent(item, context)
File "/home/alex/projects/production/plone4_dev/eggs/Products.ResourceRegistries-2.0.6-py2.6.egg/Products/ResourceRegistries/tools/JSRegistry.py", line 246, in getResourceContent
    output = BaseRegistryTool.getResourceContent(self, item, context, original)
File "/home/alex/projects/production/plone4_dev/eggs/Products.ResourceRegistries-2.0.6-py2.6.egg/Products/ResourceRegistries/tools/BaseRegistry.py", line 593, in getResourceContent
    self._restoreCachingHeaders(original_headers, if_modified)
File "/home/alex/projects/production/plone4_dev/eggs/Products.ResourceRegistries-2.0.6-py2.6.egg/Products/ResourceRegistries/tools/BaseRegistry.py", line 661, in _restoreCachingHeaders
    assert int(self.REQUEST.RESPONSE.getStatus()) / 100 == 2
AssertionError

我在过去几天一直试图解决这个问题,但主要问题是 - 此错误仅在生产配置中发生,我无法在开发环境中重现它。

问题已经开始,当使用重新设计使用新设计升级网站时,它也已从Centos 5.6移至Centos 6,但我认为这并不重要。否则bulidout.cfg保持不变。

当我试图在本地开发机器上重现错误时,我只能在实例运行时调试模式=关闭时触发它,并且该进程必须在后台运行,无论何时运行前台,错误没有被触发,显示正确的404错误信息;基本上一切都在开发环境中运行良好,但是一旦代码在生产中移动,404页面就会被破坏。

环境信息:

Plone 4.1.4
Zope 2.13.12
Python 2.6.7 (r267:88850, Dec 13 2011, 17:15:07) [GCC 4.6.2]

1 个答案:

答案 0 :(得分:1)

断言线是Plone中一个长期存在的问题,我没有遵循所有错综复杂的问题。目前还有一个涉及断言的开放式错误:

怀疑你有一个内联呈现的JavaScript资源,包括在错误页面中。似乎资源注册表断言没有考虑非200页面上的内联响应(例如404 Not Found响应)。

上述问题附有补丁。如果补丁适合您,我建议您对故障单进行评论并说明它对您有用。确认您的资源注册表中有内联JavaScript资源。