Edgewall Software

Opened 10 years ago

Last modified 7 years ago

#594 new defect

UndefinedError if output from template function is wrapped in tuple

Reported by: fschwarz Owned by: cmlenz
Priority: major Milestone: 0.9
Component: General Version: devel
Keywords: Cc:

Description

This template causes an exception: "UndefinedError: "name" not defined"

<doc xmlns:py="http://genshi.edgewall.org/">
   <py:def function="foo(name)">__${name}__</py:def>
   ${tuple(foo('bar'))}
</doc>

Once the 'tuple()' is removed everything works as expected. I found the error message very confusing as undefined variables don't have anything to do with return values of a function.

Attachments (1)

genshi-594-undefined-function-variable.patch (787 bytes) - added by fschwarz 10 years ago.
test case

Download all attachments as: .zip

Change History (3)

Changed 10 years ago by fschwarz

test case

comment:1 Changed 10 years ago by fschwarz

I also observed that this bug is triggered in general when you try to iterate over the returned function iterator. Also a list() or even [i for i in foo('bar') exhibits the same behavior.

comment:2 Changed 7 years ago by hodgestar

  • Milestone changed from 0.7 to 0.9

Moved to milestone 0.9.

Note: See TracTickets for help on using tickets.