[Zope] ZClass index_html question
Maarten Slaets
maarten.slaets@neolabs.be
Fri, 20 Jul 2001 12:05:56 +0200
Peter Bengtsson wrote:
> As a sidenote,
> create an instance and call it something less Zoponic and in the ZClass
> create an object called index_html instead. "better practice".
I made a workaround:
since I was using a root 'index_html' method which checks for index.html
files, I could modify that method to first check for instances of my
ZClass with ID index.html.
This is the dtml:
<dtml-call "REQUEST.set('zclassindexfound', '0')">
<dtml-in "objectItems(['Custom Doc'])">
<dtml-with sequence-item>
<dtml-if "_['id'] == 'index.html'">
<dtml-call "REQUEST.set('zclassindexfound', '1')">
<dtml-var index_html>
</dtml-if>
</dtml-with>
</dtml-in>
<dtml-unless "_['zclassindexfound'] == 1">
<dtml-try>
<dtml-var expr="_['index.html']">
<dtml-except KeyError>
<H1>Forbidden</H1>
You don't have permission to access <dtml-var absolute_url> on this
server.<P>
</BODY></HTML>
</dtml-try>
</dtml-unless>
When I have the time I will change this though, because this method is a
performance killer.
--
Maarten Slaets
Contact: http://zope.neolabs.be/home/maarten/maarten.vcf