aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido G√ľnther <agx@sigxcpu.org>2012-01-16 23:20:45 +0100
committerGuido G√ľnther <agx@sigxcpu.org>2012-01-16 23:21:33 +0100
commiteb76d968e87906a11910ae383f7383c9675655e9 (patch)
tree0da8705a9ad4353e63f258325a6bb36d1f30a20c
parent468bff2c268fea75af3170f8237421a26cb0213b (diff)
Make sure urlgrabber sees a string and not a unicode object
othewise it fails with "TypeError: invalid arguments to setopt"
-rwxr-xr-xindex.cgi6
1 files changed, 4 insertions, 2 deletions
diff --git a/index.cgi b/index.cgi
index 5c8339d..0a37278 100755
--- a/index.cgi
+++ b/index.cgi
@@ -45,7 +45,7 @@ def fetch_pts_page(package):
try:
url = "%s/%s" % (PTS, package)
pts = urlgrabber.urlopen(url, timeout=5.0)
- except urlgrabber.grabber.URLGrabError, (code, msg):
+ except urlgrabber.grabber.URLGrabError as (code, msg):
if code == 14:
raise Exception, "Can't find package '%s' on '%s'" % (package, PTS)
else:
@@ -110,12 +110,14 @@ def main(argv):
if pkg:
if not re.match(PKGNAMERE, pkg):
return render_search_page(title=title, err=u"Invalid package name: '%s'" % pkg)
+ else:
+ pkg = str(pkg)
else:
return render_search_page(title=title, err=err)
try:
pts = fetch_pts_page(pkg)
- except Exception, exc_err:
+ except Exception as exc_err:
err = exc_err
pts = None