[ANN] HTMLTemplate 1.0.0

Ian Sparks Ian.Sparks at etrials.com
Fri Jun 4 09:51:05 EDT 2004


Walter Dörwald wrote :
>
>XIST follows a different philosophy: All templates are pure XML (in
>fact most of our templates consist of a root element only (something
>like <newsPage/>)). The rest is done in pure Python code. The designer
>develops the XML elements for the layout.

So this is JSP taglibs for python? Taglibs seem like a good idea, code-up your own tags and sprinkle them throughout your HTML. But taken to the logical conclusion you get to monolithic tags like your <newsPage/> example.

>Our main designer had no previous programming experience and was using
>Adobe GoLive before joining our company. Now he's programming all his
>HTML templates in Python without any problems.

I can see how this would play out. You hire a web-designer and explain to them your custom tags and what they do. They start using them in GoLive (or whatever their tool of choice is) but the custom tags don't render in their tool. As the tag libraries build up in complexity the HTML migrates from the templates into the python taglib code and inevitably the designer will follow the HTML there.

Eventually the taglib becomes so customized that there is no HTML left, only custom tags. Eventually the designer abandons the "HTML template" completely and it is left as a stub like <newsPage/> (which looks a bit vestigal to me, the code equivalent of tonsils).

I'm not criticising XIST (it looks very powerful). I'm genuinely interested in what happens when you mutate HTML into a custom XML markup via taglibs : How far does it go? Is there some safe middle ground? Can you share the resulting markup language with 3rd parties or has it simply become too customized to your uses? For instance, what would be the learning curve to bring in a new HTML designer?

I've seen some advice on JSP taglibs to the effect of "keep them small and specific and don't create monolithic tags", what would your advice be for using XIST with python?

Ian Sparks.

-----Original Message-----
From: Walter Dörwald [mailto:walter at livinglogic.de]
Sent: Thursday, June 03, 2004 3:06 PM
To: python-list at python.org
Subject: Re: [ANN] HTMLTemplate 1.0.0


John Machin wrote:

> [...]
> Oh, you want *practical* experience eh? ;)
> 
> I would think the "theory" is that you've got designers/authors working 
> on templates, who don't know code. They know HTML, and know CSS, but 
> they do not program or know any code. You give these people templates to 
> work on.

XIST follows a different philosophy: All templates are pure XML (in
fact most of our templates consist of a root element only (something
like <newsPage/>)). The rest is done in pure Python code. The designer
develops the XML elements for the layout. This might be something
simple like:

class pageTitle(xsc.Element):
    def convert(self, converter):
       e = html.h1(self.content)
       return e.convert(converter)

These layout elements can then be used for a static mockup to be 
presented to the customer (i.e. <pageTitle>foobar</pagetitle>
in XML or layout.pageTitle("foobar") in Python). The developer
responsible for the dynamic part uses these layout elements with
XIST JSP elements to implement the business logic, e.g. by using
layout.pageTitle(jsp.expression("myObject.getTitle()")). It would
be possible to use any other templating system for implementing
the business logic, e.g. use PHP:
layout.pageTitle(php.expression("$myObject->getTitle()").

> [...]
> Another successful separation of logic from presentation... or so the 
> theory goes... ;)

XIST uses another version, just that both logic and presentation
are implemented in Python. ;)

You have to say goodbye to your HTML editor with this approach, but
this gives you better control over your HTML code anyway.

Our main designer had no previous programming experience and was using
Adobe GoLive before joining our company. Now he's programming all his
HTML templates in Python without any problems.

Bye,
    Walter Dörwald

-- 
http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list