[Zope] _ in a product

Toby Dickenson tdickenson@geminidataloggers.com
Thu, 05 Oct 2000 15:23:58 +0100


On Thu, 05 Oct 2000 16:03:24 +0200, Pierre-Julien Grizel
<grizel@mouli.net> wrote:

>Correcting my earlier post, I'd "simply" like to have a way to get the _
>(namespace) variable in a product method.
>Currently, I use the following syntax :
>
><dtml-var "product.method (_, 'Hello, world !')">
>
>to pass _ to my product.
>
>It works, but..... Reminds me of the great times when my hammer was the
>dtml-method......
>
>
>
>
>Has anyone a way to acquire _ in a product without constrainging the
>user to pass it explicitly ??????

Have a look at

http://www.zope.org/Members/htrd/howto/FunctionTemplate

Its a wrapper object for python functions that gives them *exactly*
the same calling convention as dtml methods. I developed this as a way
to replace overworked dtml without having to modify every other bit of
dtml that called it.

define your function as

def my_method(self,_):
    stuff goes in here

to invoke it from dtml use <dtml-var my_method>



Toby Dickenson
tdickenson@geminidataloggers.com