[Zope] Nesting method calls

Anders Qvist Anders Qvist <quest@valdez.netg.se>
Thu, 1 Jul 1999 07:15:45 +0200 (CEST)


I'm new to the mailing list so I don't know if this is a new topic, but I
couldn't get anything useful from the docs/faqs on the topic.

In "authors" I'm trying to do this:

<!--#with "_.namespace(heading='Authors and their works', 
                       body=authors_body())"-->
<!--#var sixfield_page-->
<!--#/with-->

In "authors_body" I try to do this:

<!--#in get_all_authors-->
  <!--#with "_.namespace(heading=last_name + ', ' + first_name, 
                         body=rid)"-->
  <!--#var sixfield_textblock-->
  <!--#/with-->
<!--#/in-->

"sixfield_page" and "sixfield_textblock" uses the data from heading and
body to construct HTML pages. get_all_authors is an SQL query. I get the
error:

Error Type: KeyError
Error Value: get_all_authors

  File /home/quest/dls/Zope-2.0.0a3-src/lib/python/ZPublisher/Publish.py, line 256, in publish_module
  File /home/quest/dls/Zope-2.0.0a3-src/lib/python/ZPublisher/Publish.py, line 161, in publish
  File /home/quest/dls/Zope-2.0.0a3-src/lib/python/ZPublisher/mapply.py, line 154, in mapply
    (Object: authors)
  File /home/quest/dls/Zope-2.0.0a3-src/lib/python/ZPublisher/Publish.py, line 98, in call_object
    (Object: authors)
  File /home/quest/dls/Zope-2.0.0a3-src/lib/python/OFS/DTMLDocument.py, line 181, in __call__
    (Object: authors)
  File /home/quest/dls/Zope-2.0.0a3-src/lib/python/OFS/DTMLDocument.py, line 177, in __call__
    (Object: authors)
  File /home/quest/dls/Zope-2.0.0a3-src/lib/python/DocumentTemplate/DT_String.py, line 514, in __call__
    (Object: authors)
  File /home/quest/dls/Zope-2.0.0a3-src/lib/python/DocumentTemplate/DT_With.py, line 133, in render
    (Object: _.namespace(title='Authors and their works', 
                       body=authors_body()))
  File /home/quest/dls/Zope-2.0.0a3-src/lib/python/DocumentTemplate/DT_Util.py, line 315, in eval
    (Object: _.namespace(title='Authors and their works', 
                       body=authors_body()))
  File &lt;string&gt;, line 0, in ?
  File /home/quest/dls/Zope-2.0.0a3-src/lib/python/OFS/DTMLMethod.py, line 152, in __call__
    (Object: authors_body)
  File /home/quest/dls/Zope-2.0.0a3-src/lib/python/DocumentTemplate/DT_String.py, line 514, in __call__
    (Object: authors_body)
  File /home/quest/dls/Zope-2.0.0a3-src/lib/python/DocumentTemplate/DT_In.py, line 628, in renderwob
    (Object: get_all_authors)
KeyError: (see above)

Can someone:
  a) Explain what's wrong
  b) Point me to a solution to the problem
  c) Tell me if this is an effective way to do things; if I'm using Zope
     the way it was meant.

In case anyone wonders, sixfield_page and sixfield_textblock are the only
methods in the whole site that acctually contain any serious amount of 
HTML. A dozen different pages are generated in a similar manner, just
using different queries and texts.

Anders "Quest" Qvist
NetGuide Scandinavia

-- Why suffer scarcity? Look for the Open Source and enter a world of plenty!