purcell / airspeed

A lightweight Python template engine compatible with Velocity, used in OpenStack
Other
91 stars 37 forks source link

Support for dict array-like access and $foreach variables #3

Closed erasmospunk closed 11 years ago

erasmospunk commented 11 years ago

Can use now in loops: $foreach.count, $foreach.index, $foreach.hasNext, $foreach.first and $foreach.last

Also it is possible now to get an object like this: person["name"] additionally to the classical way person.name

purcell commented 11 years ago

Once again, looks great! Thanks for this.

purcell commented 11 years ago

I waited a little while before merging, so I grabbed your 0.4 fixes too, and I've pushed an egg for that version to pypi.

erasmospunk commented 11 years ago

Perfect! I didn't realize that the 0.4 fixes went to this pull request, I was not sure that the particular namespace fix was the best one but it didn't break anything and fixed my issue. Thanks for the credits and for the opportunity to contribute!

purcell commented 11 years ago

I actually didn't review the namespace fix because I didn't notice the extra commits until after I had merged. But I'll check over it now... :-)

purcell commented 11 years ago

Okay, I took a look now. I also have a suspicion that bigger changes are needed to fix this "properly", but I couldn't easily figure out what they would be (everything I tried broke large numbers of tests), and I'm happy with your solution for now. I guess I swapped this code out of my brain a few years ago, and it would take a while to swap it back in. ;-)

Thanks again.