Templating engine?
Paramjit Oberoi
p_s_oberoi at hotmail.com
Tue Jun 22 10:59:54 EDT 2004
>> The second point above is why I don't understand your claim that the
>> separation of presentation logic and markup would be easier to maintain.
>
> I can work on the HTML using all my favourite standard HTML tools, and
> the code using all my favourite standard Python tools. I can deal with
> each half individually without having the other getting in my way and
> spoiling my view. I can hash around the HTML as much as I like with,
> at most, minimal breakage - the only stuff in the HTML to break is the
> name bindings that tie it to the Controller code, and those are
> quickly and easily replaced. The API is very small and simple. How I
> structure my code is not dictated by the structure of my template. The
> implementation can be as granular as you like, so should be easy to
> test and profile right down to the atomic level. I can hand the HTML
> half to one developer to take care of and the code half to another.
OK, pretty good arguments. I see the point. I guess I would see it more
strongly if my favourite tool for editing both HTML and python wasn't a
standard text editor <0.5 wink>.
>> By flexibility I meant flexibility in what you can do by modifying the
>> template alone (since presentation logic can be added to the template).
>> In the case of 'DOM-style' systems you may have to edit the template as
>> well as the presentation logic (which would mean modifying the
>> 'program', not just the template).
>
> You're making a false distinction here. The template and the
> presentation logic are as much a part of the "program" as the business
> layer they sit on top of. Editing the template markup is modifying the
> application. Editing the template logic is modifying the program.
I think it is a very real distinction. If you are a user of the
application, you don't want to have to maintain a private set of
modifications to it. Also, the application might be installed in a
read-only location... It might even be compiled, once all the python
compilers really take off.
> Now, if you believe that it's the templating system's job to impose
> and enforce a certain kind of architecture upon the developer - one
> that makes it impossible to mix presentation and business logic
> together - then you can certainly make that argument. The popularity
Not at all. In fact, it's the HTMLTemplate-like systms that enforce the
separation of markup from all code. With Cheetah you can have as little
or as much code in the template as you want---no separation of any kind is
enforced. This lack of enforced separation of markup and code is really
convenient.
-param
More information about the Python-list
mailing list