问题:每当用户导航到错误页面时,而不是在 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 保持不变。
当我试图在本地开发机器上重现错误时,我只能在实例以 debug-mode = off 运行时触发它,并且进程必须在后台运行,只要它在前台运行,错误就不会'不会被触发并显示正确的 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]