From 58ced7c998424be00d9a0aa7db4c9aed14fdd730 Mon Sep 17 00:00:00 2001 From: Gunnlaugur Thor Briem Date: Wed, 8 Jun 2011 21:25:31 +0000 Subject: [PATCH] Restore Py2.5 compatibility --- cas_provider/models.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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, -- 2.20.1