mikeboers / PyHAML

Pythonic implementation of HAML, cross compiling to Mako template syntax.
BSD 3-Clause "New" or "Revised" License
97 stars 13 forks source link

NameError: global name 'next' is not defined (Python 2.5) #6

Closed al-the-x closed 13 years ago

al-the-x commented 13 years ago

Hey, I know this isn't really an issue for most, since we've all abandoned Py2.5 for anything later, but I'm using PyHAML on Google App Engine. Most of the 2.6 features work, but not this one. I'm patching for the moment, but it might be worth noting that PyHAML requires Py2.6+ in the docs... Or using something else in haml/parse.py:27. Thanks for your exceptional work.

mikeboers commented 13 years ago

I don't think I'm using too much that is new in 2.6. Let me see if I can get it working for you...

mikeboers commented 13 years ago

Just pushed the fixes so all tests pass. I'm just testing with 2.7 right now as well and then I'll publish a new version to PyPi.

mikeboers commented 13 years ago

Fixed in https://github.com/mikeboers/PyHAML/commit/45db152f9c8754ef3f8f249f3e68114c83f8580d and published to PyPi as 0.1.4.

al-the-x commented 13 years ago

Thanks, I did something similar in my patch. I'll post a gist. I'm interested in your "backwards.py" implementation... Not quite sure I understand it at first glance. I just did:

try: next
except NameError:
    def next ( obj ): return obj.next()

I'll have to read through your change to understand it, I think. Mine was probably too simplistic. Thanks for the patch!

mikeboers commented 13 years ago

It is designed to perfectly mimic the behaviour of the 2.6 next, but I will admit that (at the currently time) is quite overkill as I'm not using the extra behaviours anyways.