[Zope] indirection question

Jeremy M. Smith jeremy@whatever.ucdavis.edu
Wed, 30 Jan 2002 15:44:51 -0800 (PST)


Hello--

I'm having a problem with indirection. I have a form object that has a
header method. I also have a DTML method called showForm:

<dtml-var "form.header()">

The problem is that the name of the form object that I'm calling is
variable. From all of the Zope docs and howtos, _[var] should allow you to
do indirection. I'm putting the actual name of the form object as a
parameter to showFormm so this should work:

<dtml-var "_[form].header()">

But this gives me an AttributeError of  __hash__ error with the following 
traceback:

Traceback (innermost last):
  File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 223, in publish_module
  File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 187, in publish
  File /usr/local/zope/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook
    (Object: Traversable)
  File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 171, in publish
  File /usr/local/zope/lib/python/ZPublisher/mapply.py, line 160, in mapply
    (Object: index_html)
  File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 112, in call_object
    (Object: index_html)
  File /usr/local/zope/lib/python/OFS/DTMLMethod.py, line 189, in __call__
    (Object: index_html)
  File /usr/local/zope/lib/python/DocumentTemplate/DT_String.py, line 540, in __call__
    (Object: index_html)
  File /usr/local/zope/lib/python/DocumentTemplate/DT_Util.py, line 339, in eval
    (Object: showForm(form=dumbform))
    (Info: showForm)
  File &lt;string&gt;, line 0, in ?
  File /usr/local/zope/lib/python/OFS/DTMLMethod.py, line 182, in __call__
    (Object: showForm)
  File /usr/local/zope/lib/python/DocumentTemplate/DT_String.py, line 540, in __call__
    (Object: showForm)
  File /usr/local/zope/lib/python/DocumentTemplate/DT_Util.py, line 339, in eval
    (Object: _[form].header())
    (Info: form)
  File &lt;string&gt;, line 0, in ?
  File /usr/local/zope/lib/python/DocumentTemplate/DT_Util.py, line 167, in careful_getitem
AttributeError: (see above)

I'm sure I'm missing something obvious here.

Any ideas?

Thanks,

Jeremy.

--------------------------------------------
Jeremy M. Smith <jeremy@ucdavis.edu>
Technical Support Manager, Programmer
University of California, Davis
Languages and Literatures
Language Learning Center