How do web templates separate content and logic?

George Sakkis george.sakkis at gmail.com
Wed Jul 2 11:09:10 EDT 2008


On Jun 30, 3:16 pm, Mike <ter... at gmail.com> wrote:
> On Jun 30, 1:41 pm, George Sakkis <george.sak... at gmail.com> wrote:
>
>
>
> > Because _typically_ a web template consists of mostly HTML, with
> > relatively little presentational logic and (ideally) no business
> > logic. Now, if all one wants to do is a quick and dirty way to, say,
> > view a log file in the browser, a separate template is probably an
>
> The keyword here is "(ideally)". These _typical_ cases are pretty much
> restricted to a helloworld-like examples or to a pure men log file
> browser ;).

That's the opposite of what I said. For helloworld-like examples, a
web template is an overkill. It's non-trivial applications that can
show off what a template language buys you.

> Real application templates quickly became complicated and
> require full blown scripting engine. Zope/Plone/Trac templates are
> good examples of this.

What does "this" refer to? Injecting business logic or just
complicated presentational logic?

> > ... It's a matter of
> > relative frequencies which language is the embedded one.
>
> Take a look at, say,http://trac.edgewall.org/browser/trunk/trac/templates
> It is not obvious what relative frequency is higher. For other systems
> the
> situation is similar I believe.

I took a look and as much as I like Python for general programming, I
find these templates more readable and maintenable than straight
string-concatenating Python. YMMV.

George



More information about the Python-list mailing list