From: Gunnlaugur Thor Briem Date: Wed, 8 Jun 2011 21:25:31 +0000 (+0000) Subject: Restore Py2.5 compatibility X-Git-Tag: 22.4~32^2~17 X-Git-Url: https://git.mdrn.pl/django-cas-provider.git/commitdiff_plain/58ced7c998424be00d9a0aa7db4c9aed14fdd730?hp=0ea3daef05a6126e6429d37d9706aef785104802 Restore Py2.5 compatibility --- diff --git a/cas_provider/models.py b/cas_provider/models.py index ec4b695..2075c2e 100644 --- a/cas_provider/models.py +++ b/cas_provider/models.py @@ -6,6 +6,12 @@ import string import urllib import urlparse +if hasattr(urlparse, 'parse_qs'): + parse_qs = urlparse.parse_qs +else: + # Python <2.6 compatibility + from cgi import parse_qs + __all__ = ['ServiceTicket', 'LoginTicket'] @@ -42,7 +48,7 @@ class ServiceTicket(BaseTicket): def get_redirect_url(self): parsed = urlparse.urlparse(self.service) - query = urlparse.parse_qs(parsed.query) + query = parse_qs(parsed.query) query['ticket'] = [self.ticket] query = [ ((k, v) if len(v) > 1 else (k, v[0])) for k, v in query.iteritems()] parsed = urlparse.ParseResult(parsed.scheme, parsed.netloc,