Translator/render() strangeness
I just tried to use Translator in 2.3.1 for the first time. It behaves strange when I use <dtml-lvar some_image>, and it seems to hinge on something in DT_Util.render(): def render(self, v): "Render an object in the way done by the 'name' attribute" if hasattr(v, '__render_with_namespace__'): v = v.__render_with_namespace__(self) else: vbase = getattr(v, 'aq_base', v) if callable(vbase): if getattr(vbase, 'isDocTemp', 0): v = v(None, self) else: v = v() return v When I use <dtml-lvar some_image>, the image is eventually passed to render() by Translator/LocalizeTag. Some print statements reveal in this case: type(v) = <extension class Acquisition.ImplicitAcquirerWrapper at 40201e60> callable(v) = 1 type(vbase) = <extension class OFS.Image.Image at 85acac0> callable(vbase) = 1 So render calls the line "v = v()". Result: Traceback (most recent call last): File "/net/fs-1/bigdisk/opt/zope/current/lib/python/Products/Translator/Loc alizeTag.py", line 102, in render return str(render(md, v)) File "/net/fs-1/bigdisk/opt/zope/current/lib/python/DocumentTemplate/DT_Uti l.py", line 282, in render v = v() AttributeError: __call__ So v is callable, but v() returns this attribute error? (I've wrapped the v=v() inside a try:except: and it now works again...) -- Cees de Groot http://www.cdegroot.com <cg@cdegroot.com> GnuPG 1024D/E0989E8B 0016 F679 F38D 5946 4ECD 1986 F303 937F E098 9E8B
participants (1)
-
cg@cdegroot.com