[Zope] incosistant behaviour.

Tres Seaver tseaver@palladion.com
Thu, 25 May 2000 11:27:08 -0400


Curtis Maloney <curtis@umd.com.au> wrote:

> Greetings,
>
> I am experimenting with my first ZClass.  I have inherited from
> Renderable, and XMLDocument.  I have added a few DTML Methods,
> including a 'render' method.
> 
> Testing has been all well and good, with pages displaying
> predictably when I hit the View tag, but if I hit View in the
> folder, which contains one of my classes as index_html, it
> doesn't display correctly.

You are up against a known problem, i.e., that ZClass instances can't
function as directly-renderable objects:

  http://classic.zope.org:8080/Collector/476/view

The workaround is to download the contributed Renderable-ZClass
product:

  http://www.zope.org/Members/lalo/Renderable-ZClass

and derive your ZClass from the mix-in it provides (migrating an
existing ZClass to it is painful, but doable).

> 
> My class relies on being able to find methods in itself (using
> _.hasattr() ), but the results are as if it cannot find any.  I
> thought this might be because render is a dtml Method, so I tried
> it as a DTML Document.  Now when trying to view it, it asks for
> authentication, and denies anyone (even the superuser).
> 
> What am I doing wrong?  Shouldn't a ZClass member method be able
> to reference other members in the same ZClass?

Hmm, I don't know if this is the same problem;  I'm sure that you
can't have a ZClass instance function as the index_html for a folder
out-of-the-box, though.

Tres.
-- 
=========================================================
Tres Seaver                          tseaver@digicool.com
Digital Creations   "Zope Dealers"   http://www.zope.org