Skip to content

'for' could carry an implied 'if-any' #4

@GoogleCodeExporter

Description

@GoogleCodeExporter
A template containing "[for SEQ_ITEM]", where there's no SEQ_ITEM in the
data dictionary, will raise an Exception.  I'm okay with that, and the
workaround is generally just to ensure that there *is* a SEQ_ITEM item in
the data dictionary.

Now if, by way of workaround, you make SEQ_ITEM's dummy value [], stuff
works.  But if (as part of a pattern of initializing data dictionary items)
you instead use None, the template complains.  You can work around this in
the templates by always doing:

  [if-any SEQ_ITEM][for SEQ_ITEM] ... [end][end]

But I wonder if [for] shouldn't imply an existence check, and just be as
satisfied with gracefully not looping over a None value as it is with not
looping over an empty sequence value.

Original issue reported on code.google.com by cmpilato on 19 Mar 2009 at 4:55

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions