[mod_python] Templating Systems

Roberto Aguilar roberto.c.aguilar at gmail.com
Wed Jul 13 23:31:21 EDT 2005


I'm quite the fan of having the python code deal strictly with an
xml.dom.minidom object and at the end pass it along to the browser,
or, if the client doesn't support XML, transform it server-side.

I'm currently using libxsltmod to do server-side transforms:

import libxsltmod, xml.dom.minidom

xslPath = '/path/to/xsl'
doc = xml.dom.minidom.Document()

[...]

req.write(libxsltmod.translate_to_string(
            'f', xslPath,
            's', doc.toxml()))

-berto.

On 7/13/05, Joshua D. Drake <jd at commandprompt.com> wrote:
> 
> > 1. Python code executed as part of Template with call outs to get data. (eg PSP)
> > 2. Psuedo code executed as part of Template will call outs to get data. (eg Cheetah)
> > 3. DOM like object manipulated from outside by Python code (eg HTMLTemplate)
> > 4. Template execution populates fields in template from prebuilt dictionary.
> > 5. Markup is embedded within actual Python code.
> >
> > What sort of system do you prefer to work with? PHP can be likened to
> > 1 and 2.
> 
> Well I am used to smarty which as close as I can tell is like number 3.
> I was also considering just using XSLT. I have not ever messed with XSLT
> but figured it might be a good way to go.
> 
> Sincerely,
> 
> Joshua D. Drake
> 
> 
> 
> >
> > Some system have a cleaner conceptual seperation of view from
> > controller (code to populate it), eg., HTMLTemplate, thus allowing third
> > party web site design programs to still be used.
> >
> > Graham
> 
> 
> --
> Your PostgreSQL solutions provider, Command Prompt, Inc.
> 24x7 support - 1.800.492.2240, programming, and consulting
> Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit
> http://www.commandprompt.com / http://www.postgresql.org
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>



More information about the Mod_python mailing list