Zope vs Php

Mike Meyer mwm at mired.org
Thu Nov 17 18:52:28 EST 2005


"Steve" <steve.morin at gmail.com> writes:

> I am going to go the mod_python route.
>
> as for why a person would go route one over route 2
>
> is that the number of lines of html/output vs python code are usually
> 10 to 1 and it's much easier to encapsulate the python code than to
> quote and escape all the html/css/xml

It is? When doing that, I tend to write things like:

html_data = """
Lots of HTML text here, with the random %(name)s thrown in to insert values.
"""

# Python code to put values in html_dictionary

print html_data % html_dictionary

The only quoting of the HTML is the two sets of triple-quotes to wrap
the whole thing. The escaping is done in the python, to make sure the
values in the dictionary are properly escaped.

Usually, multiple such pieces get pasted together at the end of the
function.

That said, I have to confess that lately I've been using Cheetah
templates, because the syntax for inserting values is simpler, and the
way Cheetah templates work naturally in the Python inheritance
hierarchy.

        <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list