Like most things, web development follows fads. Rewind a bit: AJAX was the poster child of next-generation web development. Then it was SOAP and other sundry XML-based services. Location and real-time are currently hot topics among the Web 57.0 crowd. In the process, XML fell out of favor, replaced by fancy new data transport formats like JSON and (for your performance-obsessed backend service writers) flexible cross-language interface definition languages like Thrift and protobuf.
Okay. So XML sucks, blah blah blah. Why would you want to hack support for it into PHP, much less Python?
Let me say this: using XML as a templating language is far, far different from using it as a data transport mechanism. For the latter, it's impossibly verbose. For the former, however, it's incredibly natural; if you've done any web development, you've already been using a (less strictly-validated) version of XML.
Fine. Writing XML is like writing HTML. Why should I care?
- With XHPy (which, for lack of a better name, is what I'm calling this XHP-Python hybrid), you can write your own tags. It's like an extensible version of HTML without all that XSLT crap, expressed in a relatively natural Pythonic syntax.
- XHPy takes care of HTML escaping automatically, and you can always define tags to perform other escaping/internationalization/general string transformations.
- XHPy allows you to build templates without requiring external templating languages, template files, or any of that nonsense. In this sense, it is a templating language, but it's a templating language that integrates tightly with Python itself.
Alright, enough ranting about the virtues of XHPy. If you're curious, the repo is up on my github page; I'm currently working on easy_install integration, but for now you'll have to git clone the repo and add it to your PYTHONPATH.
Enjoy! I hope this benefits someone out there; as usual, bug reports/fixes and comments are always welcome.