我可以直接在Diazo规则中测试Plone页面的存在吗?

时间:2013-05-24 16:25:44

标签: plone diazo

我编写了一条Diazo规则,允许用户通过编辑网站中的特定页面来自定义Plone网站的页脚。以下规则符合我的要求:

<replace css:theme-children="#portal-footer"
  css:content-children="#content-core"
  href="/theme_resources/footer"
  if="$footer_id = 'footer'" />

在高级设置中使用以下参数表达式:

footer_id = context/theme_resources/footer/id | nothing

如果我不包含条件,当用户删除或移动/ theme_resources / footer时,我得到以下回溯并且主题根本不应用:

2013-05-28 10:46:55 ERROR plone.subrequest Error handling subrequest to /theme_resources/footer
Traceback (most recent call last):
  File "c:\plone43\eggs\plone.subrequest-1.6.7-py2.7.egg\plone\subrequest\__init__.py", line 116, in subrequest
    traversed = request.traverse(path)
  File "c:\plone43\eggs\zope2-2.13.19-py2.7.egg\ZPublisher\BaseRequest.py", line 518, in traverse
    return response.notFoundError(URL)
  File "c:\plone43\eggs\zope2-2.13.19-py2.7.egg\ZPublisher\HTTPResponse.py", line 718, in notFoundError

当我包含条件时,如果用户删除参数表达式,则主题会中断。

我可以在规则上使用不同的条件来直接测试页面是否存在变量吗?

1 个答案:

答案 0 :(得分:0)

您无法直接使用Diazo测试是否存在任意内容对象。

如果在条件评估为false时您的问题是视觉断开的主题,则可以使用具有完全相反条件的其他规则,以便您可以在Diazo图层中获得动态回退。但是,在这种情况下,我只是在HTML中放置一个静态后备页脚,以便在规则未应用时使用它。

另一方面,如果您的页面被删除后,如果您的主题未完全应用 ,请发布追溯。

相关问题