Zope question

Samuel A. Falvo II kc5tja at garnet.armored.net
Mon Mar 13 13:24:35 CET 2000


In article <8ad88c$kss$1 at news.univ-metz.fr>, Gabriel Soubies wrote:
>I know this is not exactly a python question, but there is no Zope NG and
>many python users know Zope, so I figured you could help me.

Zope has a public mailing list which you can learn how to subscribe to on
their website.  www.zope.org.

>The general structure of the table is right, I've tried it.
>GeneralMenu is a DTML document in the standart elements folder.
>PageText is the text of the page, it's a DTML document in the text folder
>(the second on I explained).
>Footer is again in the standart elements folder.

Here's your problem.  The way you have described it, your tree looks like so:

/
   StandardElements
      GeneralMenu
      Footer
   TextFolder
      SamplePage

In order to solve this problem you need to learn the rules of acquisition.
Let's say that SamplePage has a <dtml-var Footer> tag in it.  This tells
Zope to evaluate the contents of Footer.  But since Footer isn't in the
TextFolder folder, it then proceeds to its immediate parent (in this case
the root folder).  Since it's not there either, Zope gives up and conks out
with an error.

What you need to do is place all common elements in the folder which
contains all of your more detailed folders.  Think of it in terms of class
inheritance relationships.  So if you re-organize your object tree to this:

/
   GeneralMenu
   Footer
   TextFolder-1
      SamplePage-1
      SamplePage-2
   TextFolder-2
      SamplePage-3
      SamplePage-4

now, all sample pages can "inherit" the same general menu and footer.

NOTE: I strongly suggest you use DTML Methods instead of DTML documents.
There are slight semantic differences with DTML methods and documents which
can cause subtle website bugs (e.g., such as the values of certain
properties, etc).

>My question is :how do paths work?

Paths work precisely as you expect them to in any POSIX development
environment.  A path that starts with a `/' is an absolute path, so the
absolute path to SamplePage-4 above would be /TextFolder-2/SamplePage-4.

Note also that you can use relative paths, and in fact, this is almost
always what you want to do anyway.  If you have any experience moving a
website from one service provider to another, you'll understand precisely
what I mean.  :)

However, it seems that what you need to brush up on with Zope is its form of
inheritance called "Acquisition."  This is documented on their website as
well, though I don't recall where.  But nonetheless, what Zope describes in
several pages of text I can describe in a two sentences, "If the file or
variable isn't defined in the current folder, check the parent folder.  If
it's not there, continue checking parent folders until you can't anymore."
This is also true of properties as well as files.

-- 
KC5TJA/6, DM13, QRP-L #1447
Samuel A. Falvo II
Oceanside, CA



More information about the Python-list mailing list