[Twisted-web] fix nevow exception in args parsing

Matt Goodall matt at pollenation.net
Sat Sep 3 03:13:14 MDT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrea Arcangeli wrote:
> I noticed an exception in nevow, for example with divmod.com/?=x=x=x.
> 
> This is the fix, please apply this (or an equivalent one) to SVN:
> 
> Index: Nevow/nevow/url.py
> ===================================================================
> --- Nevow/nevow/url.py	(revision 1748)
> +++ Nevow/nevow/url.py	(working copy)
> @@ -21,7 +21,7 @@
>  def _uqf(query):
>      for x in query.split('&'):
>          if '=' in x:
> -            yield tuple( [urllib.unquote_plus(s) for s in x.split('=')] )
> +            yield tuple( [urllib.unquote_plus(s) for s in x.split('=')[:2]] )
>          elif x:
>              yield (urllib.unquote_plus(x), None)
>  unquerify = lambda query: list(_uqf(query))

I don't think that's correct - it throws away information. A better
solution is probably:

    yield tuple( [urllib.unquote_plus(s) for s in x.split('=', 1)] )

Do you agree? If so, I'll apply this fix later.

- - Matt

- --
     __
    /  \__     Matt Goodall, Pollenation Internet Ltd
    \__/  \    w: http://www.pollenation.net
  __/  \__/    e: matt at pollenation.net
 /  \__/  \    t: +44 (0)113 2252500
 \__/  \__/
 /  \	       Any views expressed are my own and do not necessarily
 \__/          reflect the views of my employer.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDGWkqPpOMbs6rEZERAn7GAJ47QPgvkjdOS9SI5jLrZsdCnnwsXgCfbFwx
ef8CSTRNYq2VGWo6hCoO0lI=
=fUlK
-----END PGP SIGNATURE-----



More information about the Twisted-web mailing list