[Zope-dev] local index_html in ZClass instance
Michel Pelletier
michel@digicool.com
Wed, 19 Apr 2000 10:08:57 -0700
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?
No, it is by design.
ObjectManagers do not allow you to create an object contained in them
that allready uses that id, *or is allready an attribute (like a method)
of that ObjectManager*.
Your ZClass does not 'contain' a method object. Rather, the method
object is a method of your ZClass. The method managment view *looks*
like the container managment view, but it is a different beast. methods
in the ZClass Methods view will become attributes of your ZClass
instances, *not* children in a containment relationshipsub-objects.
When you try and create a sub-object of your object it gives you an
error because your objects (an instance of your ZClass) allready has an
attribute (a method) by that name.
> Is there a solution?
Have your ZClass's index_html method defer it's action until run-time:
<dtml-if FrontPage>
<dtml-var FrontPage>
<dtml-else>
<dtml-var myObscureDefaultContent>
</dtml-if>
Make 'myObscureDefaultContent' a method of your ZClass, this is what is
your index_html method of the ZClass now. If the user creates a new
method in the ObjectManager called 'FrontPage', it will be displayed
instead.
-Michel
>
> regards,
> Heiko
>
> --
> heiko.stoermer@innominate.de
> innominate AG
> networkingpeople
> fon: +49.30.308806-0 fax: -77 web: http://innominate.de
>
> _______________________________________________
> Zope-Dev maillist - Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope )