Suggestions on getting proper URL in ZPT?
Hi all, I've got a few page templates that need to contain references to Python scripts that are in parallel directories to them. How can I make this work so that no matter where the page template is used, it is always able to call the Python script? One way I thought of was simply obtaining the url of the page template, relative to the server root, and working from there. But I don't know how to find the URL of the page template. Any sort of suggestions would be appreciated. Alec Munro
Alec Munro writes:
I've got a few page templates that need to contain references to Python scripts that are in parallel directories to them. How can I make this work so that no matter where the page template is used, it is always able to call the Python script? You might try the "container" predefined variable. It is the container, the template is located in.
Dieter
I didn't explain this one properly at all. I need to have href links to the python scripts. So if the container had a property like URL, that would be handy. But I think I found a way around it. Thanks very much. Alec
-----Original Message----- From: Dieter Maurer [mailto:dieter@handshake.de] Sent: July 31, 2002 6:58 PM To: Alec Munro Cc: zope@zope.org Subject: Re: [Zope] Suggestions on getting proper URL in ZPT?
Alec Munro writes:
I've got a few page templates that need to contain references to Python > scripts that are in parallel directories to them. How can I make this > work so that no matter where the page template is used, it is always > able to call the Python script? You might try the "container" predefined variable. It is the container, the template is located in.
Dieter
Alec Munro wrote:
I didn't explain this one properly at all. I need to have href links to the python scripts. So if the container had a property like URL, that would be handy. But I think I found a way around it.
container.whatever.your_python_script.absolute_url() should work. cheers, Chris
participants (3)
-
Alec Munro -
Chris Withers -
Dieter Maurer