[Zope-dev] Adding functions to _

Itamar Shtull-Trauring itamar@maxnm.com
Mon, 18 Sep 2000 12:23:14 +0200


I'm using CVS Zope, and I want to add a function of mine to _, so I have the
following code in a Product's __init__.py:

    from log2vis import log2vis
    from DocumentTemplate.DT_Util import d
    d["log2vis"] = log2vis

However, when I call the function, I get an error about DocumentTemplate,
from which I discovered that when I call _.logvis('a_string'), instead of
the string being passed as the first parameter, _ is passed as the first
parameter to my function, forcing me to truncate it when calling log2vis:

    from log2vis import log2vis
    from DocumentTemplate.DT_Util import d

    def log2vis_wrapper(*args, **kwargs):
        return apply(log2vis, args[1:], kwargs)

    d["log2vis"] = log2vis_wrapper


Any idea what could cause this strange behaviour?  it doesn't happen for
other functions inserted into _ in DT_Util.py.

-- 
Itamar S.T.  itamar@maxnm.com
Fingerprint = D365 7BE8 B81E 2B18 6534  025E D0E7 92DB E441 411C