----- Original Message ----- From: "John D. Rowell" <jdrowell@appwatch.com> To: <zope@zope.org> Sent: Monday, April 24, 2000 8:06 PM Subject: Re: [Zope] How does one access a ZClass property from a ZClass method?
<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?
There has been talk of trying to create a mechanism to do this, but there's a very good reason for the way it works now. When you access the method via a URL, Zope automatically passes in the requisite namespace, REQUEST, etc. If you do, <dtml-var method> this is equivalent to <dtml-var name=method>. In this context, Zope passes the proper parameters in automatically as well. <dtml-var "method(_.None, _)"> is equivalent to <dtml-var expr="method(_.None, _)"> which is actually a Python expression. And *that's* why you need to pass in those parameters... because Zope is not doing the calling... python is. And python does not automatically pass the namespace in as a parameter. There has been talk about trying to change this in the past, but no one had concrete said they were going to try to implement something. Personally, I don't think it's so bothersome when you get used to it. In fact, I've even used the client parameter (the first argument) for a useful purpose a couple of times. Kevin