Comment 2 for bug 897755

Revision history for this message
Luc Saffre (luc-saffre) wrote :

(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
        else:
            #~ if self.exprResult:
            if context.has_key(self.iter):
                del context[self.iter]

See also http://code.activestate.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