On Mon, Apr 28, 2008 at 9:40 AM, Ian Bicking <i...@colorstudy.com> wrote:The problem of two formats cascades through the simplest helpers to
> Michael van Tellingen wrote:
> > I was looking at the modeltags feature in the new webhelpers.
> We decided this was the easiest way as the code produced is both valid
> Specifically, all empty tags (br, input, etc) get a trailing />, making
the complex functions that depend on them. Do you pass an argument
through all of them to choose the output style? How do you know
whether your arguments are HTML or XHTML? It's the same problem
caused by the str/unicode split in Python: the dilemma cascades up to
every function that uses strings. Are my arguments str or unicode or
mixed? Should that affect my output, or should I just ignore the
problem? If I ignore it my users will get UnicodeDecodeError or
UnicodeEncodeError whenever a string contains non-ASCII characters.
It gets worse if you have a Unicode subclass, as
WebHelpers/Genshi/Quixote do to implement start HTML escaping. It
works great if your arguments are Unicode, but what if they're str and
contain non-ASCII characters? This came up last week when
redirect_to() blew up because url_for() was returning a literal, which
it shouldn't have. (Literal is a Unicode subclass, but redirect_to()
can't accept Unicode.)
If you want a choice of well-formed HTML or well-formed XHTML, use
From one of the talkbacks in the article:
That's the situation we're left with. Write XHTML but serve it as
I also feel kind of deceived that the XHTML mantra said it would lead
In the meantime, the main rule for serving XHTML as HTML is, as Ian
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.