durusmail: quixote-users: New syntax for PTL templates?
New syntax for PTL templates?
2002-10-08
2002-10-08
2002-10-08
2002-10-08
2002-10-09
2002-10-09
2002-10-09
2002-10-09
2002-10-10
PTL for SQL (was Re: [Quixote-users] New syntax for PTL templates?)
2002-10-10
python 2.2 required for widgets
2002-10-28
2002-10-28
2002-10-28
2002-10-28
quote keyword on widget constructors
2002-10-29
2002-10-29
2002-10-29
2002-10-28
2002-10-28
2002-10-29
2002-10-29
2002-10-29
2002-10-10
New syntax for PTL templates?
dbinger
2002-10-09
On Tuesday, October 8, 2002, at 08:58 PM, Joel Shprentz wrote:

> At 10:46 AM 10/8/02, Greg Ward wrote:
>> IOW, I would favour
>>
>>   def foo(...):
>>     define a regular function
>>
>>   template foo [plain] (...):
>>     define a template that returns plain (un-marked-up, needs-to-be-
>>     quoted-if-included-in-HTML) text
>>
>>   template foo [html] (...):
>>     define a template that returns HTML text
>
> I agree with Greg on distinguishing templates, which return
> concatenated expression values, and functions, which return None or
> some specified value.
>

I disagree with this notion.  Templates and functions are not
distinguished
by what types of things they return:  either may return anything.
The distinction is only in what they do with statements whose
values are string (-like), and in what they return by default.
A template really *is* a function written in a convenient format.

The answer to the question of how to make sure the reader notices when
templates
are being used is not so clear to me.  "template foo [html] " seems
okay,
but I prefer "def foo [html]".  The word in brackets makes these defs
stand
out sufficiently, I think.  I also like it for being slightly more
compact, and
because emacs will colorize the def form without any special
customization. ;)



reply