[MERGE] Fix ability to use IIS as a dumb HTTP server. (fixes #247585)

Forest Bond forest at alittletooquiet.net
Mon Jul 14 19:16:44 BST 2008


Hi,

On Tue, Jul 15, 2008 at 03:04:29AM +0900, Stephen J. Turnbull wrote:
> Adrian Wilkins writes:
>  > {{{ python25\lib\rfc822.py:646
>  > # XXX Should fix unquote() and quote() to be really conformant.
>  > # XXX The inverses of the parse functions may also be useful.
>  > 
>  > 
>  > def unquote(s):
>  >     """Remove quotes from a string."""
>  >     if len(s) > 1:
>  >         if s.startswith('"') and s.endswith('"'):
>  >             return s[1:-1].replace('\\\\', '\\').replace('\\"', '"')
>  >         if s.startswith('<') and s.endswith('>'):
>  >             return s[1:-1]
>  >     return s
>  > 
>  > }}}
> 
> That's hideous.  It will reduce '''"<this>"''' to '''this'''.  What in
> the world are they trying to do?  Surely the intent of quoting in that
> example is to protect the angle brackets from being stripped.

This isn't true.  '''"<this>"''' becomes '''<this>''':

  >>> print rfc822.unquote('''"<foo>"''')
  <foo>

Is there a bug with backslash handling, though?

  >>> print rfc822.unquote(r'"\\""')
  "

Shouldn't that be a slash followed by a quote?

-Forest
-- 
Forest Bond
http://www.alittletooquiet.net
http://www.pytagsfs.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080714/0691b8b0/attachment.pgp 


More information about the bazaar mailing list