PyMeld
15th May 2003
PyMeld is a concrete implementation of something I’ve been thinking about for months: A template system that takes an XHTML page as a template and manipulates it based on cloning and modifying elements within the template identified using their ID attribute. It’s a very elegant solution that makes good use of Python’s object overloading support to make manipulating templates as intuitive as possible. Maybe the same thing will be possible in PHP once the new overloading functions become part of the standard package.
If you decide to have a play with PyMeld you may run in to the limitation that, because class
is a reserved word in Python, you can’t set the class of an element using the standard page.someElementID.class = "something"
syntax. You can however achieve the same thing using Python’s setattr
built in function: setattr(page.someElementID, 'class', 'something')
. That tip comes courtesy of the module’s author who sorted it out for me within about 10 minutes of my email query.
More recent articles
- Notes from Bing Chat—Our First Encounter With Manipulative AI - 19th November 2024
- Project: Civic Band - scraping and searching PDF meeting minutes from hundreds of municipalities - 16th November 2024
- Qwen2.5-Coder-32B is an LLM that can code well that runs on my Mac - 12th November 2024