From 4b593b735d022d7a0bdf8e0119fc7209eaabb3d1 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 8 Dec 2013 20:37:05 -0800 Subject: [PATCH] gallery.py: Python-3-compatible parse_qs import Python 2's urlparse.parse_qs moved to urllib.parse.parse_qs in Python 3. --- posts/gallery/gallery.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/posts/gallery/gallery.py b/posts/gallery/gallery.py index 1a3c958..b97835c 100755 --- a/posts/gallery/gallery.py +++ b/posts/gallery/gallery.py @@ -51,7 +51,10 @@ import os.path as _os_path import random as _random import re as _re import subprocess as _subprocess -import urlparse as _urlparse +try: # Python 3 + import urllib.parse as _urllib_parse +except ImportError: # Python 2 + import urlparse as _urllib_parse import xml.sax.saxutils as _xml_sax_saxutils @@ -246,7 +249,7 @@ class CGIGalleryServer (object): Specify either query or query_string, but not both. """ if query is None: - query = _urlparse.parse_qs(query_string) + query = _urllib_parse.parse_qs(query_string) page = 0 if 'pp' in query: pp = query['pp'] -- 2.26.2