empty generator function causes traceback
Bug #897755 reported by
Luc Saffre
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Appy |
New
|
Undecided
|
Unassigned |
Bug Description
If I repeat a paragraph using the following formula::
do text for pp in properties_list()
and if `properties_list()` is a generator function,
then appy.pod works only correctly if the generator function actually yields values.
See attached demo of the bug.
The docstring in test.py explains a simple workaround.
Not urgent, but worth a closer look.
To post a comment you must log in.
(I just stumbled again over this bug)
To solve this, I suggest to change one line in appy.pod. actions. Action. do() method (near the end):
if hasHiddenVariable:
context[ self.iter] = hiddenVariable has_key( self.iter) :
else:
#~ if self.exprResult:
if context.
del context[self.iter]
See also http:// code.activestat e.com/recipes/ 413614- testing- for-an- empty-iterator/
for another facet of this problem: you cannot simply test "if x" to see if an iterator is empty.
This works for lists and tuples, but not for generator functions.
Luc