[Zope] Aquisition..hurts so good

Dieter Maurer dieter@handshake.de
Tue, 27 Mar 2001 23:29:38 +0200 (CEST)


Mike Webb writes:
 > ....
 > <dtml-var expr="aq_parent.aq_parent.learnix_984971699.index_html()">
 > 
 > index_html contains:
 > 
 > <dtml-var raw_index>
 > 
 > With raw_index being a method of the ZClass of the learnix_984971699 object.
 > I get the error:
 > 
 > Error Type: KeyError
 > Error Value: raw_index
Your problem has nothing to do with acquisition....

It is a standard error made over and over again:

  DTML objects are called with two positional parameters called
  "client" and "REQUEST".

  When you let DTML call the object, then it calls
  it with "_.None" and "_" as parameters.
  The "_" propagates the namesspace.

  When you call the object explicitly (as you do) and
  do not pass the namespace, a DTML Method starts
  with an empty namespace and any access to a Zope object will
  give you a KeyError.


Details in 

  URL:http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html



Dieter