[Zope-dev] Calling a DTML Method from Python
Martijn Faassen
m.faassen@vet.uu.nl
Wed, 08 Sep 1999 15:58:08 +0200
Hi there,
I'm attempting to write a product that calls a DTML method during its
processing. The product keeps a table of DTML method objects and has a
method that determines what DTML method to call, and then calls it. I'm
not sure _how_ I should call a DTML method object, though.
Example:
class Foo:
def __init__(self):
self.map = {}
def setMap(self, keyword, method):
self.map[keyword] = method
def render(self, keyword):
return self.map[keyword]() # ?? What arguments are needed?
Then, from DTML:
<dtml-call "foo.setMap('hey', somemethod)">
...
<dtml-var "foo.render('hey')">
Is this possible at all? I assume render() actually needs extra
arguments to make this work, but which?
The DTML Method source defines this:
def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw):
What does the client argument stand for? Anything else I should watch
out for?
I keep running into mysteries like this continuously, it seems...
Regards,
Martijn