Update redirector to python 3
authorMagnus Hagander <magnus@hagander.net>
Fri, 28 Jun 2019 14:13:36 +0000 (16:13 +0200)
committerMagnus Hagander <magnus@hagander.net>
Fri, 28 Jun 2019 14:28:15 +0000 (16:28 +0200)
redirector/redirector.py

index 27f15f006b7b843a92c56ca966614a2374a46bd1..4f8fa9dcd0b8b61ba489065987f27c7684400c07 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 """PostgreSQL Planet Aggregator
 
 This is a FastCGI implementation of the planet URL redirector.
@@ -9,7 +9,7 @@ URL for the post requested.
 Copyright (C) 2011 PostgreSQL Global Development Group
 """
 
-import ConfigParser
+import configparser
 import psycopg2
 
 # Simple map used to shorten id values to URLs
@@ -66,7 +66,7 @@ def application(environ, start_response):
                        "<a href=\"%s\">moved here</a>\n" % r[0][0],
                        "</body>\n</html>\n"
                        ]
-       except Exception, ex:
+       except Exception as ex:
                start_response('500 Internal Server Error', [
                                ('Content-type', 'text/plain')
                                ])
@@ -77,6 +77,6 @@ def application(environ, start_response):
                        ]
 
 
-c = ConfigParser.ConfigParser()
+c = configparser.ConfigParser()
 c.read('redir.ini')
 connstr = c.get('planet', 'db')