[Zope] How does one access a ZClass property from a ZClass method?

John D. Rowell jdrowell@appwatch.com
Mon, 24 Apr 2000 17:06:42 -0700


On Mon, Apr 24, 2000 at 05:51:20PM -0600, Michael Grinder wrote:
> I have a ZClass with a property sheet that contains two properties. I then
> created a method for the ZClass that tried to access the properties. For
> example: I created a property sheet that contained a float property named
> "high". I then created a DTML memo in the methods section of the
> ZClass. But when I put something like <dtml-var high> in the method, I get
> a KeyError saying that high doesn't exist? Obviously, I'm not
> understanding something somewhere. What am I doing wrong?

How are you calling your ZClass? If it is from a <dtml-var> statement,
you need to specify the namespace explicitly for some odd reason:

	<dtml-var "zclass.method(zclass, _)">

Which reminds me, will ZClasses be auto-renderable inside tags in the
future? It seems silly that you can have an index_html method that is
rendered from a URL, but have to specify stuff as above to use it from
other DTML Methods/Documents. Is there a better way that I'm not aware
of?

Cheers,
jdrowell

-- 
John Douglas Rowell            Home of jdfetch 0.4.0, jdresolve 0.5.2,
me@jdrowell.com                jdrinfo 0.2, jdtracker 0.11 and
http://www.jdrowell.com        jdwhatsnew 0.21
Member of the AppWatch staff - http://appwatch.com - staff@appwatch.com