[Zope] Z class complexities

Nolan Darilek nolan_d@bigfoot.com
Sun, 01 Oct 2000 01:26:15 -0500


I'm having a kinda complex problem, and hopefully my explanation can
do it justice. :)

I'm using zope to construct an XML document from the contents of a
folder. Basically, the folder's index.xml iterates through the
folder's contents, rendering each object to produce the final
document. The objects are separate z classes which combine various
properties into a small snippet of the larger XML document.

The z class has a render() method which combines the properties into
the XML snippet. I have a Render view configured to run this method,
and it works. (Though for some reason it adds a <html><head>..., which
I'd really like to get rid of. How can I?)

I've written the index_html to collect the individual objects and
concatenate their contents into an XML document. The code for the
method is below:

<?xml version="1.0"?>
<espsetup-list>
<dtml-in "PARENTS[0].objectValues('ESPPackage')" sort=title>       
<dtml-var "_[_['id']].render()">
</dtml-in>                                                                     
</espsetup-list>

This almost gives me what I want (I say "almost" because everything
works, short of the render() call.) Viewing this results in:



+----------------------------------------------------------------------------+
||Zope Error                                                                 |
||                                                                           |
||Zope has encountered an error while publishing this resource.              |
||                                                                           |
||Error Type: KeyError                                                       |
||Error Value: title                                                         |
||---------------------------------------------------------------------------|
||                                                                           |
||Troubleshooting Suggestions                                                |
||                                                                           |
||   o This resource may be trying to reference a nonexistent object or      |
||     variable title.                                                       |
||   o The URL may be incorrect.                                             |
||   o The parameters passed to this resource may be incorrect.              |
||   o A resource that this resource relies on may be encountering an error. |
||                                                                           |
||For more detailed information about the error, please refer to the HTML    |
||source for this page.                                                      |
||                                                                           |
||If the error persists please contact the site maintainer. Thank you for    |
||your patience.                                                             |
+----------------------------------------------------------------------------+


Traceback (innermost last):
  File /usr/local/zope/e1/lib/python/ZPublisher/Publish.py, line 222, in publish_module
  File /usr/local/zope/e1/lib/python/ZPublisher/Publish.py, line 187, in publish
  File /usr/local/zope/e1/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook
    (Object: Traversable)
  File /usr/local/zope/e1/lib/python/ZPublisher/Publish.py, line 171, in publish
  File /usr/local/zope/e1/lib/python/ZPublisher/mapply.py, line 160, in mapply
    (Object: index.xml)
  File /usr/local/zope/e1/lib/python/ZPublisher/Publish.py, line 112, in call_object
    (Object: index.xml)
  File /usr/local/zope/e1/lib/python/OFS/DTMLMethod.py, line 172, in __call__
    (Object: index.xml)
  File /usr/local/zope/e1/lib/python/DocumentTemplate/DT_String.py, line 528, in __call__
    (Object: index.xml)
  File /usr/local/zope/e1/lib/python/DocumentTemplate/DT_In.py, line 691, in renderwob
    (Object: PARENTS[0].objectValues('ESPPackage'))
  File /usr/local/zope/e1/lib/python/DocumentTemplate/DT_Util.py, line 337, in eval
    (Object: _[_['id']].render())
    (Info: _)
  File &lt;string&gt;, line 0, in ?
  File /usr/local/zope/e1/lib/python/OFS/DTMLMethod.py, line 168, in __call__
    (Object: render)
  File /usr/local/zope/e1/lib/python/DocumentTemplate/DT_String.py, line 528, in __call__
    (Object: render)
KeyError: (see above)

-->

I have a title variable in the z class which this index.xml method is
referencing. And, as previously stated, the render() method runs
without errors when invoked via the view. Yet, trying to display this
document from within another doesn't work. Can anyone please advise?

Thanks a bunch in advance.