Python and Zope

Paul Winkler slinkp23 at yahoo.com
Sat Oct 6 15:44:04 EDT 2001


On Sat, 06 Oct 2001 15:12:29 GMT, Magnus <nixx at telia.com> wrote:
>Hi,
>
>a few days ago I wrote my first Python script. First I though Python is 
>kind of weird, but after trying it I have to admit I love it.
>
>I was hooked by Python and decided to try Zope today for building a private 
>web-site.
>
>Now my question is:
>
> When using <dtml-var myObject> to 'include' files/objects it is working 
>well if the files are in the same directory.
>
>But how do I do this if I would like to use different directories to store 
>my objects within?
>
>Can I use some sort of objects/properties to get the BASE or URL, e.g.:
><dtml-var BASE>/myDirectory
>
>What's the best way of doing this?
>
>Thanks in advance,
>Magnus
>

This is a question for the Zope list... zope at zope.org.
A good source of answers to basic questions like this is the Zope
Book: http://www.zope.org/Members/michel/ZB
Chapter 4 might be especially useful for where you're at right now.

But I'll give some quick hints.  There are many ways to find things.
First of all, Zope's automatic acquisition mechanism means that
<dtml-var foo> will work if foo exists in the current folder *or any
parent folders.* (Acquisition is more complex and subtle than
that... but that's the easiest way to use it.)

There are also many methods that Zope provides for finding URLs. Try
making a dummy document that contains <dtml-var REQUEST> And see what
it gives you... especially have a look at URL0, URL1, ...  and BASE0,
BASE1 ...  All of these can be used like <dtml-var BASE0>.  <dtml-var
absolute_url> is also useful.


Hope that helps,

-- Paul Winkler





More information about the Python-list mailing list