Skip to content

Commit

Permalink
Restore Py2.5 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
gthb committed Jun 8, 2011
1 parent 0ea3dae commit 58ced7c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cas_provider/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
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']

Expand Down Expand Up @@ -42,7 +48,7 @@ class Meta:

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,
Expand Down

0 comments on commit 58ced7c

Please sign in to comment.