durusmail: quixote-users: Docstring for html.py
Docstring for html.py
Docstring for html.py
Patrick K. O'Brien
2002-05-22
> > It *is* confusing, because there are two levels of quoting going on
> > here: URL and HTML.  For example, let's say you have a URL with
> > 'action' and 'section' parameters, and you want the section to be the
> > string 'R&D'.  You'd have to write 'action=search§ion=%s' %
> > html.url_quote('R&D').  This results in the string
> > 'action=search§ion=R%26D'.  But if you're putting the URL into an
> > HTML page, it needs to be quoted for HTML properly with html_quote(),
> > and you get the final HTML text 'action=search&keyword=R%26D'.
>
> Now *that* example I can follow just fine. It isn't the concepts
> that are a
> problem, just the wording of the current example in the docstring. I'd
> suggest replacing it with the one you just gave here.

I just realized what I found confusing about the existing example:



Note that since href is an attribute, its value should usually be quoted
with value_quote.  To see why this is necessary, consider the URL:

    http://example.com/?a=1©=0

As a URL this is perfectly valid.  However, when placed in an HTML document
the string "©" should be interpreted as the copyright character.



When it says that "©" should be interpreted as the copyright character I
thought it was referring to the example URL (http://example.com/?a=1©=0)
appearing in HTML. If you wanted that URL to be in your HTML it should *not*
be interpreted as the copyright character. Otherwise the link wouldn't make
sense.

Is that clear as mud? In any case, I liked your other example better since
it avoids my misinterpretations altogether.

---
Patrick K. O'Brien
Orbtech



reply