Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GoogleCodeExporter opened this issue Aug 22, 2015 · 1 comment
Open

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

GoogleCodeExporter opened this issue Aug 22, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

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

@gstein
Copy link
Owner

gstein commented Aug 22, 2015

CC: @cmpilato

@gstein gstein self-assigned this Aug 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants