diff options
author | pjenvey <devnull@localhost> | 2008-11-18 23:59:33 +0000 |
---|---|---|
committer | pjenvey <devnull@localhost> | 2008-11-18 23:59:33 +0000 |
commit | 832c4db10dc053745ee7a7db919a16ed12e9588d (patch) | |
tree | 13194c0486133b571eb42110c3302eb425451748 /paste/util | |
parent | 328dbcc280f1e2652fefdd0c7f2ea73eac56bdbf (diff) | |
download | paste-832c4db10dc053745ee7a7db919a16ed12e9588d.tar.gz |
make html_unquote('') consistently return u'' everywhere -- re.sub('', '', u'')
started acting differently as of 2.5.1
Diffstat (limited to 'paste/util')
-rw-r--r-- | paste/util/quoting.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/paste/util/quoting.py b/paste/util/quoting.py index cd87f2d..bd3ae0c 100644 --- a/paste/util/quoting.py +++ b/paste/util/quoting.py @@ -50,13 +50,17 @@ def html_unquote(s, encoding=None): >>> html_unquote('<hey you>') u'<hey\xa0you>' >>> html_unquote('') - '' + u'' >>> html_unquote('&blahblah;') u'&blahblah;' >>> html_unquote('\xe1\x80\xa9') u'\u1029' """ if isinstance(s, str): + if s == '': + # workaround re.sub('', '', u'') returning '' < 2.5.1 + # instead of u'' >= 2.5.1 + return u'' s = s.decode(encoding or default_encoding) return _unquote_re.sub(_entity_subber, s) |