Opened 18 years ago
Closed 18 years ago
#45 closed defect (fixed)
<py:for> directive doesn't handle a structured list of variable
Reported by: | cboos | Owned by: | cmlenz |
---|---|---|---|
Priority: | minor | Milestone: | 0.3 |
Component: | Template processing | Version: | devel |
Keywords: | py:for | Cc: |
Description
I've got a backtrace while trying to enumerate the items of a dict:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://markup.edgewall.org/" > <!--! This doesn't work --> <py:for each="idx, (k, v) in enumerate(dict(a=1, b=2).items())"> <p>$idx: key=$k value=$v</p> </py:for> <!--! This is a workaround --> <py:for each="idx, kv in enumerate(dict(a=1, b=2).items())"> <p>$idx: key=${kv[0]} value=${kv[1]}</p> </py:for> </body> </html>
This is either a bug, or a documentation issue, i.e. I think it's not absolutely necessary to support this, as the workaround is easy.
Would be nice to have it, though, or at least to have a better error message.
Change History (3)
comment:1 Changed 18 years ago by cboos
- Version changed from 0.2 to devel
comment:2 Changed 18 years ago by cmlenz
- Milestone set to 0.3
Yeah, would be nice if that worked as expected.
comment:3 Changed 18 years ago by cmlenz
- Resolution set to fixed
- Status changed from new to closed
Should be fixed in [276].
Note: See
TracTickets for help on using
tickets.
The backtrace in question:
(using r260)