[Zope-dev] __call__ hell :-(

Chris Withers chrisw@nipltd.com
Tue, 26 Sep 2000 11:36:29 +0100


:-(

Right, I have a Python product with a __call__ method that is
(hopefully) going to be used to render a navigation tree.

To do this (and have the tree expand in the right places) I need a list
of objects that need to be expanded.

I'm currently using the following expression to get this list:

        objects = copy(self.REQUEST.PARENTS)
        objects.reverse()

Now, to this I need to append the PARENTS[0-1] object, if you see what I
mean. In DTML, it would be this(), but I'm stumped as to what I should
append in Python.

self is just the navigator object.

If I redefine __call__ as def __call__(self, client, REQUEST) I just get
a TypeError:
Error value: not enough arguments; expected 3, got 1

If I use a safer signature def __call__(self,client=None) then client is
always None, and so not what I'm after at all.

I had a look at DTMLMethod.py and PythonMethod.py to try and get a clue
btu just got very scared.

Can someone please help me out here?

cheers,

Chris

PS: If there's a totally different way to get the containment list of
objects that need to be expanded, I'd love to hear it :-)