diff -r 5f2081181055 -r 03430023ce82 req.py --- a/req.py Wed Jan 20 15:03:30 2010 +0100 +++ b/req.py Thu Jan 21 10:19:38 2010 +0100 @@ -9,6 +9,7 @@ from urllib import quote as urlquote, unquote as urlunquote from datetime import time, datetime, timedelta +from cgi import parse_qsl from logilab.common.decorators import cached from logilab.common.deprecation import deprecated @@ -259,6 +260,16 @@ except UnicodeDecodeError: # might occurs on manually typed URLs return unicode(urlunquote(quoted), 'iso-8859-1') + def url_parse_qsl(self, querystring): + """return a list of (key, val) found in the url quoted query string""" + if isinstance(querystring, unicode): + querystring = querystring.encode(self.encoding) + for key, val in parse_qsl(querystring): + try: + yield unicode(key, self.encoding), unicode(val, self.encoding) + except UnicodeDecodeError: # might occurs on manually typed URLs + yield unicode(key, 'iso-8859-1'), unicode(val, 'iso-8859-1') + # bound user related methods ############################################### @cached