Ionrock Dot Org

by Eric Larson

My Weblog

XSLTemplates 0.6

The other day I released XSLTemplates 0.6. The big change is including a template constant middleware that accepts a dictionary of items to include in the template by default. It automatically includes the WSGI environ dict in the template params.

The big question is how to use it? Well, one tactic is to go ahead and add one instance around the whole app adding any configuration details. In Bright Content we list the URLs of some services that will be used in the paste config file. I then wrap my BC instance with a TemplateConstants middleware that places environment dict and application configuration details found in the .ini. You can also use it more granular by wrapping different classes with their own instances. Really the idea is to use it where you have the same parameters in many different calls so you don't have to always remember to add them to the set_params call.

The next big change is using the xsl:output element to set the content type of the output. Currently you set the content type using the calling middleware. This is not very WSGI-ish b/c there is an actually calling middleware in the sense an application controls the value. It would be more in the spirit of WSGI to pass along that control to the template renderer. With that in mind, you can set the media type attribute in the xsl:output element and that will be the content type used in the response.

This is probably the last release of XSLTemplates for a little while as we migrate things into Akara. After that, I hope we can create some built options to allow relatively granular installs of different Akara components for use in WSGI apps.

Posted Thu Apr 3 18:31:21 2008 by Eric Larson

Twitter

Links

Reading

Created using Python, jQuery and Emacs