[Zope] ZClass index_html question

Peter Bengtsson mail@peterbe.com
Fri, 20 Jul 2001 14:21:04 +0200


Well, the not performance killing workaround was not to name the instance
index_html and instead have an index_html in the ZClass.
That solves your problems for the moment.


----- Original Message -----
From: "Maarten Slaets" <maarten.slaets@neolabs.be>
To: "Peter Bengtsson" <mail@peterbe.com>
Cc: <zope@zope.org>
Sent: Friday, July 20, 2001 12:05 PM
Subject: Re: [Zope] ZClass index_html question


> 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