# HG changeset patch # User Brian Neal # Date 1321735637 21600 # Node ID 93e9e7b3d2ae6ced4dd373b628ad54037e64c8f7 # Parent 1d2473f4bcaa8dde8e24c69632e05415250167ff Put in an import dance for Python 2.5. Apparently cgi.parse_qs was copied to urlparse in Python 2.6. So look for it first in urlparse, and if not found, try cgi. diff -r 1d2473f4bcaa -r 93e9e7b3d2ae bns_website/videos/admin.py --- a/bns_website/videos/admin.py Sat Nov 19 14:39:28 2011 -0600 +++ b/bns_website/videos/admin.py Sat Nov 19 14:47:17 2011 -0600 @@ -5,6 +5,11 @@ import datetime import urlparse +try: + from urlparse import parse_qs +except ImportError: + from cgi import parse_qs # for Python 2.5 + from django.contrib import admin from django.contrib import messages from gdata.youtube.service import YouTubeService @@ -31,7 +36,7 @@ """ # Find the playlist ID: parts = urlparse.urlparse(playlist.playlist_url) - query = urlparse.parse_qs(parts.query) + query = parse_qs(parts.query) if 'list' not in query: messages.error(request, 'Invalid playlist %s' % playlist.playlist_url) @@ -69,7 +74,7 @@ for vid in vids: for link in vid.link: parts = urlparse.urlparse(link.href) - query = urlparse.parse_qs(parts.query) + query = parse_qs(parts.query) if 'v' in query: vid_ids.append(query['v'][0]) break