[Zope-dev] ZClasses instances become detached from class

Alexander Staubo alex@mop.no
Sun, 11 Jul 1999 00:27:29 +0200


ZClass methods do not show up inside instances. This is intentional. Of
course, you can override methods in an instance by creating them inside
a specific instance. But everything defined within the ZClass itself
belongs to the ZClass.

And that's why, even though you created your index_html, it doesn't show
up in the management interface.

(Note, though, that if you're implying that your index_html isn't
available even when viewing the instance normally, eg.,
http://www.foo.com/myinstance/index_html, then disregard this
information. I misinterpreted your problem.)

This distinction between class and instance is significant. One caveat
concerns folders: Don't make the mistake of creating a folder within
your class. If you do that, each instance will inherit this folder, as
expected. But any modifications to perform on the folder -- including
adding objects -- will show up in all instances. (Of course, there might
be cases where this is exactly the intended effect.) So in this case you
should not create the folder within the class, but let one of your
methods create it.

(Imho, this is a weakness in the current ZClass model: You can't add
constructors. So given the previous paragraph, there's no way you can
say, "When an instance of this class is created, such and such folder
should be created within the instance.")

--
Alexander Staubo             http://www.mop.no/~alex/
"What the hell, he thought, you're only young once, and threw
himself out of the window. That would at least keep the element of
surprise on his side."
--Douglas Adams, _The Hitchhiker's Guide to the Galaxy_

>-----Original Message-----
>From: zope-dev-admin@zope.org [mailto:zope-dev-admin@zope.org]On Behalf
>Of Jason Spisak
>Sent: 9. juli 1999 22:46
>To: zope-dev@zope.org
>Subject: [Zope-dev] ZClasses instances become detached from class
>
>
>Zopeists,
>
>I created a new ZClass with no index_html for viewing.  The n I made an
>instance of it.  Then I went back into the ZClass and created an
>index_html.  Now, to my understanding, and the way it used to work, is
>that the index_html will be added for all the instances.  However there
>is no index_html in the instance.  Somewhere the instance go separated
>from it's class.  Anyone else have that same issue?
>
>
>--
>Jason Spisak
>webmaster@mtear.com
>
>_______________________________________________
>Zope-Dev maillist  -  Zope-Dev@zope.org
>http://www.zope.org/mailman/listinfo/zope-dev
>
>(For non-developer, user-level issues, use the companion list,
>zope@zope.org, http://www.zope.org/mailman/listinfo/zope )
>