[Zope-dev] Calling a DTML Method from Python
Evan Simpson
evan@4-am.com
Wed, 08 Sep 1999 09:59:37 -0500
Martijn Faassen wrote:
> 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?
1. Will your DTML Methods try to acquire anything?
Normally, a DTML Method's 'client' is its acquisition parent (I think).
If you don't care, use None, otherwise pass '_' or 'this()' through a
parameter of render.
2. Do they care about form/environment variables or "REQUEST.set(..."
stuff?
If so, pass REQUEST through render, otherwise omit it from the call.
3. Do you want to intercept RESPONSE redirections, etc.?
If so, pass your own object as RESPONSE, otherwise the method should grab
it from REQUEST (unless you didn't pass REQUEST <wink>).