Opened 15 years ago
Last modified 8 years ago
#323 new enhancement
Error message is confusing if <py:for ...> lacks each=""
Reported by: | brandon@… | Owned by: | cmlenz |
---|---|---|---|
Priority: | major | Milestone: | 0.9 |
Component: | Template processing | Version: | 0.5.1 |
Keywords: | Cc: | brandon@… |
Description
I probably use too many templating languages, but a few minutes ago I wrote this when using Genshi:
<py:for loop="item in mylist">
and was greeted with the perplexing error message "TypeError?: argument of type 'NoneType?' is not iterable". This was rather bewildering and it took several minutes for me to work out what was going wrong. It seems that the error message is, instead of pointing out the actual error, leaking an internal detail about how Genshi works: when it asks itself what value I supplied for each="", it gets back the answer None if I failed to specify each="".
Could the error message be re-worded to something like: "py:for is missing each="" attribute" or something?
That would point users at the solution much more effectively.
Thanks!
Change History (3)
comment:1 Changed 15 years ago by cmlenz
- Milestone changed from 0.6 to 0.6.1
comment:2 Changed 14 years ago by Carsten Klein <carsten.klein@…>
comment:3 Changed 8 years ago by hodgestar
- Milestone changed from 0.6.1 to 0.9
Move to milestone 0.9.
The error results from the statement
Here, the NoneType? is not iterable, see the attached patch that will issue the error on both attach and on init
directives.py