简体   繁体   English

Zope将URL映射到视图

[英]Zope mapping URLs to views

I am debugging large Zope application, and no experience with Zope Framework. 我正在调试大型Zope应用程序,并且没有Zope Framework的经验。 I am trying to find code which is called requests. 我试图找到称为请求的代码。

All I know, that pages are generated by calls to instances of Products.Five.browser.BrowserView , but how to know which of them will be called? 据我所知,这些页面是通过对Products.Five.browser.BrowserView实例的调用而生成的,但是如何知道将调用哪个页面呢? How zope maps URLs to views? zope如何将URL映射到视图?

I think you want to know which View is called for a specific URL. 您想知道针对特定URL调用哪个View。 In all instances of Zope applications I ever came across there are files named configure.zcml in the main folder of the application, in which you can start to look how the parts are fitted together. 在我遇到的所有Zope应用程序实例中,应用程序主文件夹中都有一个名为configure.zcml的文件,您可以在其中开始查看各部分的装配方式。

If it is not apparent where to look for, you can start in one of the following places: 如果不清楚要在哪里寻找,则可以从以下位置之一开始:

  • in the instance location ( INSTANCE_HOME ) of your application, there is possibly a etc/package-includes/ path, with one ore more .zcml-files in it ("config slugs") which list packages where zope looks for configure.zcml -files 在应用程序的实例位置( INSTANCE_HOME )中,可能存在一个etc/package-includes/路径,其中包含一个或多个.zcml文件(“ config slugs”),其中列出了zope在其中查找configure.zcml软件包-档

  • all directories below $INSTANCE_HOME/Products are searched for configure.zcml -files $INSTANCE_HOME/Products下面的所有目录中搜索configure.zcml -files

There you look for sections like this:: 在这里您可以找到以下部分:

<browser:page
    for="*"
    permission="zope2.View"
    name="this_is_an_url_name"
    class="package_name.module_name.ClassName"
    />

which maps an URL to an View. 将网址映射到视图。

Also, heads up :-) Zope has some learning curve, but it is powerful. 此外,抬起头:-) Zope中有一定的学习曲线,但它强大的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM