[Zope-dev] local index_html in ZClass instance

Rik Hoekstra rik.hoekstra@inghist.nl
Wed, 19 Apr 2000 10:16:49 +0200


Heiko Stoermer wrote:
> 
> Hi,
> 
> my folderish ZClass Product already contains an index_html document. I
> would like to provide users with a possibility to create a local
> index_html document in their instance of the product. but if I create a
> local index_html, I get a key error: "already in use".
> Is this a general ZClass problem?

Hm, I would say it's a feature. In this way you can't override (and
possibly break) your invisible ZClass index_html by accident.

> Is there a solution?
>

Yes. The simplest is to change the index_html in you ZClass to something
else (like default or something) and adjust the View method (under the
view tab) of the ZClass accordingly. This way your users could add an
index_html without clashing, but it won't show automatically. So the
default method in your ZClass should look something like:

<dtml-var standard_html_header>
<dtml-if index_html>
   <dtml-var index_html>
<dtml-else>
   your default content
</dtml-if>
  .
  .
  .

THis is untested, but I think it should work. If not, at least
conditional content is the way to go.

Rik