python active web pages

Jeffrey P Shell jeffrey at
Fri Jun 4 21:14:52 CEST 1999

> i also looked at ZTemplates (a component of Zope),
>    <>,
> and while it doesn't actually embed python, it has a limited embedding
> language of its own, DTML, which gets munged into python. i must say that
> DTML looks a bit hideous (if anyone from digicool is reading, sorry guys).

Well, DTML (especially outside of Zope) is not meant to be
scripting-inside-of-HTML, which most Active Server Page type things are.
Personally, I think that is beyond hideous, the

    document.write('<TITLE>%s</TITLE>' % someTitleString)

is terrible (i have seen plenty of PHP source that looks like the above).
DTML Scripting can look quite ugly, but it's (a) safe (which is good
because DTML in Zope and even on its own can be edited through the web and
you have security issues with that), and (b) very powerful depending on the
namespace given it (which is very powerful in Zope due to the inherent
Acquisition model).

Using ZPublisher (the beast previously known as Bobo) and DocumentTemplates
is very powerful for web development.  The DocumentTemplates are meant to
be _views_ on an Object, not just a web page unto themselves.  Thus, DTML
has a lot of very powerful batch processing features (it's basically a
reporting language in its web form) and very powerful namespace features.

This seperation (which was most effective before DTML scripting, aka the
embedding of python expressions in DTML, was implemented into DTML) is very
powerful as it enforces the seperation of Code and Presentation, a rather
MVC (Model-View-Controller) style paradigm.

My first Bobo app was turning a socket server into a web application.
Since I had made my classes and the views on those classes rather seperate
in the socket server implementation, turning into a web app took only a
matter of hours.  I was able to make a very simple DTML page for displaying
results from a search form and focus on implementing some new methods
needed for this new way of accessing data.  Once those methods were
implemented, I was able to spend the rest of the day in web-designer mode
since I already knew all the data that I had available to me and I could
just write DTML and not even have to think about Python.

That was very very _VERY_ powerful to me.

I wouldn't have had such an easy (nor as fun or as flexible) time in an ASP
type environment where all the code is embedded on a page.  Granted, you
can write ASP type pages that import modules and use the beautifully simple
<%= foo %> and have a similar abstraction, but it's not built into the

DTML (esp. DTML Scripting) has gotten rather beyond control in some cases,
but I believe it's the most "right".  But yes, I work for digital creations
so I'm a bit biased.

But all that bias is based on the first time I wrote a major application
and just how _EASY_ (and powerful) that was.

Viva MVC !

> anyone have any experience with active web pages using either of these or
> something else?

yes.  :)

.jPS | jeffrey at
zope, through the web.

More information about the Python-list mailing list