Python embedded like PHP

Jon Ribbens jon+usenet at unequivocal.co.uk
Sat Mar 30 20:07:56 EST 2002


In article <23891c90.0203290655.25bbcab9 at posting.google.com>, Paul Boddie wrote:
> It's actually quite reminiscent of the earliest versions of DTML, in
> fact, where comments are used to mark the structure of the "model" as
> opposed to the special tags which were introduced in DTML later on.

Why were special tags added? I don't see any need for anything above
the two concepts of 'replacements' and 'sections' that jonpy provides.

I think the three interesting concepts in jonpy are:

  * absolute minimum of non-html code in html templates

  * correspondence between html sections and nested classes, e.g.:

    HTML:
      <p>Top level.</p>
      <!--wt:section--><p>$$replacement$$</p><!--wt:/section-->
      <p>Top level.</p>
    Code:
      class main(wt.TemplateCode):
        class section(wt.TemplateCode):
	  def replacement(self):
	    return "Section."

  * dual file hierarchy for html and code, e.g.:

      DOCUMENT_ROOT/index.html
      DOCUMENT_ROOT/img.jpg
      DOCUMENT_ROOT/thing.html
      DOCUMENT_ROOT/subdir/index.html

      DOCUMENT_ROOT/wt/index.html.py
      DOCUMENT_ROOT/wt/thing.html.py
      DOCUMENT_ROOT/wt/subdir/index.html.py

> Zope Page Templates takes the other "under the radar" approach, of
> course, using special attributes which HTML editors usually don't want
> to touch.

Presumably bad things still happen if the designer deletes the tag
itself that the magic attributes are attached to though.

> In the Python community, there is obviously an intense interest in
> templating, but I haven't seen more than a handful of validation
> packages, and I can imagine that few of them actually integrate
> satisfactorily with template packages.

I'm not sure what you mean here. Can you give an example of what a
"validation package" might do?

Cheers


Jon



More information about the Python-list mailing list