At 15:58 08/09/99 , Martijn Faassen wrote:
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?
Client is the namespace object. See the DocumentTemplate.DT_String.String.__call__ method for more information. Don't you love deep inheritance? -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-7502100 Fax: +31-35-7502111 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------