On Wed, May 22, 2002 at 04:51:29PM -0500, Patrick K. O'Brien wrote:
> Some more examples would be nice, of course.
Try this on for size (written assuming my proposed change of making
html_quote replace " with "):
========================================================================
html_quote
----------
Use for quoting data that will be used within CDATA attribute values or
as element contents. Examples:
'%s' % html_quote(title)
'' % html_quote(data)
Note that the " character should be used to surround attribute values.
value_quote
-----------
[not recommended since always using html_quote is simpler]
Use for quoting CDATA attribute values. For example:
data = '..."...©...'
...
'' % value_quote(data)
The " character will be replaced with """ and the value will be
surrounded by " characters. The & character also replaced with &
because some old browsers incorrectly interprete entity references
inside of CDATA values. This function is of marginal utility since you
can always use html_quote and surround attribute values with "
characters.
url_quote
---------
Use for quoting data to be included as part of a URL, for example:
input = "foo bar"
...
'' % url_quote(input)
Note that URLs are usually used as attribute values and should be quoted
using html_quote. For example,
url = 'http://example.com/?a=1©=0'
...
'do something' % html_quote(url)
html_quote is required because some old browsers incorrectly interprete
SGML entity references inside of CDATA attribute values.
========================================================================
Is that clearer?
> P.S. Any chance we can wean you guys off your home-grown unit test framework
> and onto the standard unittest module?
Probably not. :-)
Neil