python active web pages

Jonathan Hogg jonathan at onegoodidea.com
Sat Jun 5 00:11:29 CEST 1999


In article <7j98g1$atj$1 at autumn.news.rcn.net>, "Jeffrey P Shell"
<jeffrey at Digicool.com> wrote:

>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
>
><HTML>
><%
>    document.write('<HEAD>')
>    document.write('<TITLE>%s</TITLE>' % someTitleString)
>    ...
>%>
></HTML>
>
>is terrible (i have seen plenty of PHP source that looks like the above).

i couldn't agree more. this is what i'm trying to avoid. the most simple
model is to execute python scripts from CGI and build web-pages using
something like HTMLgen or just writing out bits of HTML as strings and
sticking in the dynamic bits in between. this is basically what the ASP
you show above does (hence making the use of ASP quite pointless in my
book).

>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.

it's the separation that i'm not sure i want. i have skimmed through the
DTML manual on your web pages and believe i understand (to a first
approximation) how it operates. the problem is that i'm not using the rest
of Zope and if i want to execute setup code, rather than just evaluate
expressions within <#var expr> tags, then i'd need to stick this into a
separate script which sucks in the template and passes in whatever data as
variables.

what i'd really like to be able to write is stuff along the lines of:

   <%
   import foobar

   your_name = foobar.frib( frob = "all" )
   nee = foobar.noneshallpass( what is your_name )
   %>

   <html>
   <head>
      <title>Wotnot</title>
   </head>
   <body>
      "We are the knights who say... <%= nee %>
   </body>
   </html>

all well and good. looks like "asp" can do this fine. but unfortunately it
won't allow me to do the *really* useful bits that ZTemplates supports:

   <h1>How do I love thee?</h1>
   <ol>
      <!--#in ways -->
         <li> <!--#var way -->
      <!--#\in -->
   </ol>

don't get me wrong, while i think the above is a *bit* hideous, it is
undeniably powerful and very close to what i'm looking for.

>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.

a very valid point of view. to be honest, how much the integration of
control and interaction will be a pain in the arse is still to be tested.

>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.

's ok, we all have our biases. these are still the sort of opinions i was
hoping to garner. thanks for your comments.

does anyone else use active web pages? surely all you python/web hackers
don't just use CGI scripts?

:-j

-- 
jonathan hogg, one good idea limited, 25 clouston street, glasgow g20 8qr, uk
jonathan at onegoodidea.com www.onegoodidea.com t:(0)976-614338 f:(0)7970-537451




More information about the Python-list mailing list