[Zope-dev] More almost __call__ ;-)

Chris Withers chrisw@nipltd.com
Fri, 13 Oct 2000 11:48:39 +0100


Jim Fulton wrote:
<snip __call__ stuff>

Okay, this is almost the same, but apparently not the same.

I have a Python Product Class, with a method, a_method, that gets called
from some of the Python Product's management screens (encapsulation is
good ;-)

This method needs several parameters from the namespace, so when it's
called I was hoping I wouldn't have to do something nasty and clunky
like:

<dtml-var "a_method(param1,param2,param3)">

Given my recently acquired __call__ Zen, I thought 'No problem...' and
tried to define the method as follows:

    isDocTemplate = 1

    def a_method(self, ignored=None, md=None):

...with the hope I'd just be able to do <dtml-var a_method> and pluck
the stuff from md.

No dice.

md and ignored turn up as None from all the <dtml-var a_method> calls.
:-(

What am I doing wrong? How can I get access to the namespace in a method
of a class like this?

cheers,

Chris