I agree and disagree with Sam here.
First, I do often use the %(name)s technique. I even made a Python mix-in
class that matches names to methods so in my templates I can use any method
of my servlet/page including inherited ones like "companyName",
"supportEMail", etc.
However, there are some advantages to something like Zope's DTML. (gasp)
1. It's easy to add options to your templating language:
<$name none="No name!">
<$total commas> -> 5,000
<$blurb maxLen=40>
2. Some environments have the following set up:
- HTML templates are written by web designers who use simple substitutions
- Python developers write all the code (if's, loop's, SQL, etc.) that
sets up the name spaces for the templates
- The two groups are entirely different people
In such a circumstance, your designers don't know Python and are very
comfortable learning and using a simple templating scheme like the one
above. It also prevents them from writing a spaghetti bowl of loops, SQL,
etc. That's what you have programmers for. :-)
BTW I realize that for my examples of options, all that could be forced
back on the Python code. However, giving your designers some influence over
such basic things is a good idea. It does fit in with "look and feel" and
reduces the roundtrips to the dev team for simple items.
I have secret (not any longer) plans of creating such a templating
component in Webware, but it's not high on the list right now. Of course,
like all Webware components, it will be optional.
I do *not* plan on adding all the other DTML style stuff to enable full
blown programming inside of HTML. For that purpose, PSP (Python Server
Pages) is far and away the clear choice.
-Chuck
At 09:34 AM 10/23/00 -0700, Sam Penrose wrote:
>Argh! I thought that embedded pseudo-Python was one of the main reasons
>we weren't all satisfied with Zope; this seems to be Yet Another Syntax
>hack. Why is
>
>Tomorrow, <$Py Tomorrow()> I cannot meet you, but next week ( <$Py
>Nextweek()> )
>better than
>
>myTemplate = open('thisTemplate.htm').read()
>print myTemplate % {'tomorrow':tomorrow(), 'nextWeek':nextWeek()}
>
>On Mon, 23 Oct 2000, you wrote:
> > Andrew Kuchling wrote:
> > >
> > > * I'd like to see better debugging support for CGI scripts. For
> > > example, using Perl's CGI.pm, if you run a script from the command
> > > line, you can enter name=value pairs on standard input. (In general
> > > it's probably worth cherry-picking any useful features out of CGI.pm
> > > or CGI modules for other languages?)
> >
> > The author of cgimodel mailed me today and reminded me to put it on my
> overview
> > page. This particular module provides such functionality, and was recently
> > featured in Linux Journal. See:
> >
> > http://www.embl-heidelberg.de/~chenna/pythonpages/
> >
> > Regards,
> >
> > Paul
> >
> >
> > To unsubscribe from this group, send an email to:
> > python-web-modules-unsubscribe@...
>
>-------------------------- eGroups Sponsor -------------------------~-~>
>eLerts
>It's Easy. It's Fun. Best of All, it's Free!
>http://click.egroups.com/1/9699/0/_/_/_/972320223/
>---------------------------------------------------------------------_->
>
>To unsubscribe from this group, send an email to:
>python-web-modules-unsubscribe@...
|