plone内容的别名
collective.fourohfour的Python项目详细描述
简介
这个包提供了一个“错误文档”,可用于404个响应 以及一些中间件来触发正确的响应。
如果在wsgi链中使用 休息室。当出现错误(例如触发404响应)时,您可以转发 到plone中的页面,该页面可以显示建议和友好的错误消息。
此外,如果在重定向存储中可以从 plone.app.redirector,将发出自动重定向,将用户 到新的一页。
最后,还有一个基本的ui来进行批量加载重定向。这是有用的,如果 你是从一个旧的地方迁移过来的(甚至可能不是一个plone的地方)。去 http://localhost:8080/your-site/@@bulk-load-aliases作为管理员用户, 并以以下格式粘贴新旧路径:
/index.php?pageId=123 => /some-page/some-where
注意:门户根路径将自动作为路径的前缀。 因此,上面在plone站点mysite上运行的示例将导致 /mysite/index.php的底层重定向?PageID=123至 /我的网站/某个页面/某个地方。假设您将使用 虚拟托管,以便“mysite”是vhm根目录,而不是显示为 URL的一部分,但重写规则的一部分。
要删除别名,请安装products.redirectiontool并使用其ui。
安装
fourohfour使用plone.app.registry和z3c.form。
要在自己的构建中使用该产品,请在setup.py文件中依赖它, 或者像平常一样把它添加到你的构建列表中。
在这两种情况下,您可能希望使用已知的一组好的包来 最小化包版本冲突的风险。例如:
[buildout] ... extends = ... http://good-py.appspot.com/release/plone.autoform/1.0b2 ... [instance] eggs = Plone collective.fourohfour ...
在生成中配置后,从portal\u quickinstaller安装包 像平常一样。
提示:您可能还想安装products.redirectiontool以获得一些gui 支持修改别名。
配置
必须将中间件配置为在粘贴HttpExceptions之前运行。为了 示例:
[filter:errorhandler] use = egg:collective.fourohfour#handler 404 = /@@404-error [filter:errorlog] use = egg:repoze.errorlog#errorlog path = /__error_log__ keep = 50 ignore = paste.httpexceptions:HTTPUnauthorized paste.httpexceptions:HTTPNotFound paste.httpexceptions:HTTPFound [app:zope2] paste.app_factory = repoze.obob.publisher:make_obob repoze.obob.get_root = repoze.zope2.z2bob:get_root repoze.obob.initializer = repoze.zope2.z2bob:initialize repoze.obob.helper_factory = repoze.zope2.z2bob:Zope2ObobHelper zope.conf = /path/to/etc/zope.conf [pipeline:main] pipeline = errorhandler egg:Paste#httpexceptions egg:repoze.retry#retry egg:repoze.tm#tm egg:repoze.vhm#vhm_xheaders errorlog zope2
请注意:
* The errorhandler middleware must be configured with a set of response types and the error page to redirect to. To use the "smart" view provided by this package, use /@@404-error. * If you use repoze.vhm for virtual hosting, the view path will be adjusted for the VHM root. Thus, in a typical setup where you virtual- host the Plone site at the root of the domain, a path of /@@404-error will do the right thing. However, if virtual hosting is not enabled, you'll need to adjust the path in the configuration file to include your Plone site, e.g. /my-site/@@404-error * The errorhandler middleware should come just before Paste#httpexceptions
可以使用相同的中间件处理其他类型的响应, 例如:
[filter:errorhandler] use = egg:collective.fourohfour#handler 404 = /@@404-error 500 = /default_error_message (This middleware is based on Paste#errordocument, but allows more of the original request to be passed through to the error handler, and also allows the error handler to raise 301/302 redirects).
更改日志
1.0A5-2011年6月20日
- 更新模板以包含定义为plone 3的全局定义 在plone 4中默认未定义。
1.0A4-2010-02-04
- 从1.0a3中修复的问题恢复到1.0a2路径处理 现在在repoze.vhm 0.12中正确处理。不要使用 此软件包的1.0a3版本。 [范希姆]
1.0a3-2009年12月26日
- 保存repoze.vhm.virtual_根目录的存储路径(如果使用 虚拟主机。这是确保它找到点击率的唯一方法 在PLONE的重定向存储中。 [范希姆]
1.0A2-2009-08-27
- 修复缺少middleware.py的损坏版本
1.0A1-2009-08-26
- 初始版本