----- Original Message ----- From: "Pablo Ziliani" <[EMAIL PROTECTED]>
To: "Zope" <zope@zope.org>
Sent: Thursday, October 19, 2006 8:54 PM
Subject: [Zope] Resolving a url from a path in a virtual host environment

Hi guys,

I'm having some trouble tying to get an object from a given path. I'm using virtual hosts, so according to Dieter's great documentation[1], REQUEST.resolve_url should do it. However no matter how creative I get making up urls, I always get a "Different namespace." ValueError. Looking at the source of resolve_url[2] I can see that it tries to ensure being at the same namespace (?) seeing if REQUEST.script is at the beginning of the passed url. So the actual problem is that this attribute always returns ""; in my (2.9.4-final) Zope instance, quite independently from my requested url.

So: should I be using some other method instead? (if so, I guess my reference is wrong or outdated). Which one? Do I need any special configuration to make REQUEST.script returns my virtual environment?
Any additional suggestion?

In case the real url after apache's rewrite is relevant, PATH_INFO and PATH_TRANSLATED are showing something like:

To have a quick look at the urls that are easily available within the REQUEST namespace create a dtml method in the 'end' folder that contains:

<dtml-var standard_html_header>
<dtml-var REQUEST>
<dtml-var standard_html_footer>

Then point your browser at this method (eg. http://www.mywebsite.com/folderA/folderB/tstmethod) and see what comes up.

Once you have located a variable that gives you what you need, you can easily access it via something like: REQUEST['URL0'] or REQUEST['BASE3']. If the path (url) you need is not located within the REQUEST namespace then you may need to work-around the problem... one possibility is to create property field on the 'top' level folder that contains the base url you need. You can than access this property field to build the required url.



Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to