4

如果在我的重氮控制面板中 > '参数表达式' 我把

have_left_portlets = python:context and context.restrictedTraverse('@@plone').have_portlets('plone.leftcolumn',context)

仅当我在门户主页上时才会收到错误消息:

2012-06-26 16:51:42 ERROR plone.transformchain Unexpected error whilst trying to apply transform chain
Traceback (most recent call last):
  File "/Users/vito/.buildout/eggs/plone.transformchain-1.0.2-py2.6.egg/plone/transformchain/transformer.py", line 48, in __call__
    newResult = handler.transformIterable(result, encoding)
  File "/Users/vito/.buildout/eggs/plone.app.theming-1.0-py2.6.egg/plone/app/theming/transform.py", line 257, in transformIterable
    params[name] = quote_param(expression(expressionContext))
  File "/Users/vito/.buildout/eggs/Zope2-2.13.13-py2.6.egg/Products/PageTemplates/ZRPythonExpr.py", line 48, in __call__
    return eval(self._code, vars, {})
  File "PythonExpr", line 1, in <expression>
  File "/Users/vito/.buildout/eggs/AccessControl-2.13.7-py2.6-macosx-10.6-x86_64.egg/AccessControl/ImplPython.py", line 675, in guarded_getattr
    v = getattr(inst, name)
AttributeError: 'FilesystemResourceDirectory' object has no attribute 'restrictedTraverse'

我该如何解决这个问题?

4

2 回答 2

3

我怀疑这是 plone.app.theming 中的一个错误:上下文设置不正确。不过很奇怪。

于 2012-06-23T08:15:20.557 回答
1

只需确认问题已存在:我得到了大约相同的回溯,站点本身看起来不错,但是对于站点内的每次点击,我都会在我的实例 fg 中得到以下回溯:

2012-08-10 15:05:05 ERROR plone.transformchain Unexpected error whilst trying to apply transform chain
Traceback (most recent call last):
  File "/opt/etc/buildout/eggs/plone.transformchain-1.0.2-py2.6.egg/plone/transformchain/transformer.py", line 48, in __call__
    newResult = handler.transformIterable(result, encoding)
  File "/opt/etc/buildout/eggs/plone.app.theming-1.0-py2.6.egg/plone/app/theming/transform.py", line 257, in transformIterable
    params[name] = quote_param(expression(expressionContext))
  File "/opt/etc/buildout/eggs/Zope2-2.13.10-py2.6.egg/Products/PageTemplates/ZRPythonExpr.py", line 48, in __call__
    return eval(self._code, vars, {})
  File "PythonExpr", line 1, in <expression>
AttributeError: 'FilesystemResourceDirectory' object has no attribute 'Language'

这是因为我的 manifest.cfg 中有以下行(与 plone_control_panel 中的参数行大致相同:

lang = python: context.Language()

在我的情况下,这在某种程度上是合乎逻辑的,因为并非所有内容对象都有一个名为 Language() 的索引。

但是在这种情况下,“上下文”显然是指“FileSystemResourceDirectory”,而不是您所在的内容?如果我能找到更多信息,我会尝试使用 pdb...

于 2012-08-10T13:23:50.210 回答