[mod_python] mod_python Live examples

Byron Ellacott bje at apnic.net
Thu Aug 19 10:18:02 EDT 2004

Nic Ferrier wrote:
> I think one of the best ways to do templating is with XSLT. I find
> that designers who understand XML can be quickly taught XSLT. It's
> pretty natural and it's also quite common and not tied to one specific
> language or operating system.

That's what I do.  GET operations fetch a view, which consists of any 
number of Python modules each returning an XML fragment (or throwing a 
redirection exception).  Those fragments are combined into a document, 
which is passed to the defined translator for the view.  Currently, the 
only translator type I have is XSLT.

POST operations call a single module to handle the operation requested, 
which returns an XML fragment and a view to display.  The engine then 
redirects (currently by calling, soon by 303ing) to the view, including 
the POSTed XML result in the output.

But I work on it in fits and starts, with little free time these days. 
There are a number of problems to solve:

  * XHTML is pretty useless as an output language, since IE does not 
support it - but you can output HTML with XSLT;
  * All the XML processing is slower than most other templating methods, 
and so caching at various levels is important; and
  * Since I'm processing an entire XML document through a translation, I 
cannot send a partial response to a client, and this vastly changes the 
user's impression of responsiveness.

The last one is the most significant.  If the browser cannot render a 
partial page, the user will feel that the application is slower to 
respond, sometimes significantly so, even if it's actually faster to 
load the complete page.  This is a major stumbling block to using XSLT 
for whole-page translations.


More information about the Mod_python mailing list