Commits

Geert Jansen committed e48ddc6

Python3 fixes (not complete yet).

Comments (0)

Files changed (4)

 from collections import namedtuple
 from httplib import responses as reasons
 from httplib import HTTP_PORT as PORT, HTTPS_PORT as SSL_PORT
-from rfc822 import formatdate as format_date
+from email.utils import formatdate as format_date
+try:
+    from urllib.parse import parse_qs
+except ImportError:
+    from cgi import parse_qs
 
 
 # Export HTTP status codes

lib/rest/msiis.py

 
 def create_isapi_handler(fname, opts):
     """Generate a Python script that will be out ISAPI entry point."""
-    fout = file(fname, 'w')
+    fout = open(fname, 'w')
     fout.write('## This file is auto-generated and will be overwritten\n')
     fout.write('from rest.msiis import Extension\n')
     fout.write('from rest.util import setup_logging\n')
 def update_web_config(webroot):
     fname = os.path.join(webroot, 'web.config')
     try:
-        fin = file(fname, 'r')
+        fin = open(fname, 'r')
         tree = ElementTree()
         tree.parse(fin)
         fin.close()
                 static.remove(node)
         if len(static) == 0:
             webserver.remove(static)
-    fout = file(fname, 'w')
+    fout = open(fname, 'w')
     tree.write(fout)
     fout.close()
     print 'Updated web.config.'

lib/rest/request.py

 # "AUTHORS" for a complete overview.
 
 import binascii
-from cgi import parse_qs
 
 from rest import http
+from rest.http import parse_qs
 from rest.error import Error as HTTPReturn
 
 
         version = tuple(map(int, version_info['version'].split('.')))
         contents += 'version = %s\n' % repr(version)
         try:
-            fin = file(fname, 'r')
+            fin = open(fname, 'r')
         except IOError:
             current = None
         else:
             current = fin.read()
             fin.close()
         if contents != current:
-            fout = file(fname, 'w')
+            fout = open(fname, 'w')
             fout.write(contents)
             fout.close()