durusmail: quixote-users: htmltext in PTL
htmltext in PTL
2004-12-10
2004-12-10
2004-12-10
2004-12-11
2004-12-11
htmltext in PTL
Mike Orr
2004-12-10
On Fri, Dec 10, 2004 at 02:17:09PM -0500, Neil Schemenauer wrote:
> I (now) think it is better to explictly import these functions if
> they are needed.  Anyone disagree?

No, then  you'd have to remember which functions are magically imported
under which circumstances.  For something like Zope's transactional
function it makes sense since it's an essential part of using the
database, but htmltext() and htmlescape() are only used occasionally.

By the way, the one annoyance I've found with PTL is, would it please stop
encoding the other operands in a "+" expression?  Nine times out of ten
when I do:
     string1 + htmltextString
string1 is preformatted HTML and I want it left as is.   In my output
filter I had to do:
    output = top + htmltext(output) + bottom
or
    output = str(top) + str(output) + str(bottom)

to make it behave.  ('top' and 'bottom' are htmltext from a PTL;
'output' is whatever the page callable returned.)

The reasoning is, an [html] function already does enough encoding.
An htmltext object outside [html] either came from such a function, or
was created merely to prevent that value from being encoded later.
Neither of these imply any wisdom about the other operands.  The
current routine may expect the htmltext to be an ordinary string, and
it may not even know what htmltext is.

--
-Mike Orr (aka. Sluggo), mso@oz.net  (iron@sense-sea-MegaSub-1-465.oz.net)
   http://sluggo.kicks-ass.org/                  Cxu vi parolas Esperante?

reply