[Zope] document_src method strangeness

Jens Vagelpohl tommymi@concentric.net
Mon, 13 Sep 1999 22:17:49 -0400


hi everyone,

i'm not sure if this is a bug or if i didn't read the documentation right. i
want to have a link at the bottom of the page called "view source" that
shows the source behind an object, just like on the new zope site. the
method is the very same as on the new zope site: framed by header and footer
i have

<pre><dtml-var "document_src(REQUEST,RESPONSE)" html_quote></pre>
<dtml-call "RESPONSE.setHeader('content-type','text/html')">

i'm having trouble when view_source encounters a tree or in-tag, but
interestingly enough the troublemakers are not within the rendered object (a
dtml-doc which uses standard-header and footer) but in the standard header.
the in/tree is activated after checking a folder attribute to look into a
subfolder and list all dtml-docs, like in:

<snip snip>
<dtml-if homeworks><dtml-with homeworks>
  <dtml-in expr="objectValues(['DTML Document'])">
    <IMG SRC="<dtml-var SCRIPT_NAME>/HelpSys/hs_dnode" ALIGN="TOP"
BORDER="0" width=16 height=16>
    <a href="<dtml-var absolute_url>"><dtml-var title></a>
  </dtml-in>
</dtml-with></dtml-if>
<snip snip>

when i use view_source on a document which does not have "homeworks" set it
works. just not when "homeworks" is there and the in-tag gets "active". i
get an error:

A horrible error occurred.
Error Type: AttributeError
Error Value: __call__

Traceback (innermost last):
  File /home/zope/Zope-2.0.0-src/lib/python/ZPublisher/Publish.py, line 214,
in publish_module
  File /home/zope/Zope-2.0.0-src/lib/python/ZPublisher/Publish.py, line 179,
in publish
  File /home/zope/Zope-2.0.0-src/lib/python/Zope/__init__.py, line 201, in
zpublisher_exception_hook
    (Object: index_html)
  File /home/zope/Zope-2.0.0-src/lib/python/ZPublisher/Publish.py, line 165,
in publish
  File /home/zope/Zope-2.0.0-src/lib/python/ZPublisher/mapply.py, line 160,
in mapply
    (Object: view_source)
  File /home/zope/Zope-2.0.0-src/lib/python/ZPublisher/Publish.py, line 102,
in call_object
    (Object: view_source)
  File /home/zope/Zope-2.0.0-src/lib/python/OFS/DTMLMethod.py, line 145, in
__call__
    (Object: view_source)
  File /home/zope/Zope-2.0.0-src/lib/python/DocumentTemplate/DT_String.py,
line 502, in __call__
    (Object: view_source)
  File /home/zope/Zope-2.0.0-src/lib/python/OFS/DTMLMethod.py, line 141, in
__call__
    (Object: standard_project_header)
  File /home/zope/Zope-2.0.0-src/lib/python/DocumentTemplate/DT_String.py,
line 502, in __call__
    (Object: standard_project_header)
AttributeError: (see above)

the puzzling aspect is that the standard header and footer don't get
"expanded" into code when i do view_source on the doc that references them,
so why could something contained within them bother the view_source or the
underlying document_src method..?

a little puzzled...

jens

Jens Vagelpohl

Systems Administrator
Washtenaw Development Council