[Zope] getitem doesn't return source code, when used with index_html
Thieu-Hon Tran
Thieu-Hon.Tran@westfleisch.de
Thu, 11 Oct 2001 08:50:17 +0200
Hello,
I've written a documentation for my Zope-project, and I want to include the
source-codes of the DTML-files I wrote. I'm using the 'getitem'-function to
accomplish this and it works with all DTML-documents and -methods, except
index_html (which is a DTML-method).
Here's how I did it:
My project consists of the following directories (among others):
/fb/
/fb/docu/
'docu' contains a DTML-method "ProgDocu". That method contains the
following source-code:
--------------------
[...]
<dtml-with fb only>
<dtml-var ShowDTMLFiles>
</dtml-with>
[...]
--------------------
ShowDTMLFiles is a DTML-method in the folder 'docu'. Here's an excerpt:
--------------------
<table border="1" cellspacing="0">
[...]
<dtml-in expr="objectValues(['DTML Method', 'DTML Document'])"
sort=id skip_unauthorized>
<tr>
<th> <dtml-var sequence-number> </th>
<td> <img src="<dtml-var icon>" alt="[Icon]"> <dtml-var id> </td>
<td>
<a href="<dtml-var id>/ShowSourcecode"> [source-code] </a>
</td>
</tr>
</dtml-in>
</table>
--------------------
ShowSourcecode is also a DTML-method in the folder 'docu':
--------------------
[...]
<div class="FBQuellcode">
<pre>
<dtml-var expr="_.getitem(_['id'], 0)">
</pre>
</div>
[...]
--------------------
The documentation is in the DTML-method 'ProgDocu'. When I call it, it
shows a table at the end, which lists all DTML-files, for which the current
user has enough permissions to view them. (yes, I do know I can use proxy
roles to also display the "forbidden" DTML-files, but I'll see for that
later) Behind every entry in that table, there's a link named
'[source-code]'. When the user clicks on it, his browser calls the e.g. URL
http://www.domain.com/fb/blabla_dtml/ShowSourcecode
which (in this case) displays an HTML-file with the sourcecode of
'blabla_dtml'.
But when one clicks on the corresponding link to display the sourcecode of
'index_html', the browser does call the correct URL
http://www.domain.com/fb/index_html/ShowSourcecode
but instead of the source-code, I only see the word 'None'. (which means
'Rendered whithout an error' as far as I know, right?)
Could anybody please tell me, what I'm doing wrong?
Thanks in advance,
Hon.