Python embedded like PHP
Andy Gimblett
gimbo at ftech.net
Wed Mar 20 05:09:30 EST 2002
On Tue, Mar 19, 2002 at 12:03:46PM -0800, Ian Bicking wrote:
> Why, oh why, does it use HTML-like syntax? People keep implementing
> templating languages that do this over and over, and it's a bad, bad
> idea. Any moderately complex example of templating will violate the
> rules of HTML/SGML, with things like <img src="<al-value
> expr="something">">, which is horrible to read, will anger WYSIWYG
> editors to no end, and isn't at all necessary.
Yeah, this puts me off Albatross too... I've just started playing
with Page Templates in Zope, and their approach seems excellent: it's
all done in _attributes_ without adding any new tags.
Have a look at this example (from
http://www.zope.org/Members/peterbe/DTML2ZPT):
<ul tal:define="sequence python:container.mydb.selectbyname(name='peter')">
<li tal:repeat="item sequence">
<span tal:replace="item/surname">surname</span>
</li>
</ul>
Now, that's perfectly valid HTML, most WYSYWIG editors will basically
ignore the tal: attributes and render a single-element list, but the
ZPT machinery in Zope will pick that up and render a multi-element
list in a manner which I think it pretty obvious from looking at the
source.
In short, I think it's super-neato. :-)
Now I need to figure out if it can be used outside of Zope. AFAIK
there _aren't_ any non-Zope implementations, although the language has
definitely been designed to be general enough to allow its use
elsewhere.
-Andy
--
Andy Gimblett - Programmer - Frontier Internet Services Limited
Tel: 029 20 820 044 Fax: 029 20 820 035 http://www.frontier.net.uk/
Statements made are at all times subject to Frontier's Terms and
Conditions of Business, which are available upon request.
More information about the Python-list
mailing list