[Zope] Me vs. The Zope Book Pt. 1
Dieter Maurer
dieter@handshake.de
Mon, 3 Feb 2003 20:24:58 +0100
Samir Mishra wrote at 2003-2-3 18:34 +0400:
> I can't get some of the things mentioned in the ZB to work as expected. If
> anyone could tell me what I'm doing wrong, that'll be much appreciated.
>
> 1. The following code -
> <dtml-tree>
> <dtml-var getId>
> </dtml-tree>
> gives me nothing! Even in root, when I'm logged in as site manager, & when
> I'm an authenticated user, when the script has a proxy role of Manager, when
> it doesn't, etc. According to ZB (pg. 124) I should see a display of an HTML
> tree. What am I missing?
Almost surely, this code is in a DTML Document (rather than DTML Method).
For some unknown (stupid) reason the base class of most
Zope object classes ("OFS.SimpleItem.SimpleItem") defines
Object Manager methods (such as those used by "dtml-tree").
Of course, these methods cannot return useful results.
DTML Document looks first in its local namespace (and finds
the bad Object Manager methods); only then it looks in
the namespace defined by its context.
DTML Method looks only in the namespace defined by its context.
As a general rule: do not use DTML Document -- unless you know
precisely what you are doing.
Dieter