Python 2.4 support
authorEric Price <ecprice@mit.edu>
Mon, 8 Oct 2007 07:39:40 +0000 (03:39 -0400)
committerEric Price <ecprice@mit.edu>
Mon, 8 Oct 2007 07:39:40 +0000 (03:39 -0400)
svn path=/trunk/web/; revision=140

templates/VncViewer.jar
templates/main.py

index 7d9d145..af710dc 100644 (file)
Binary files a/templates/VncViewer.jar and b/templates/VncViewer.jar differ
index b528b3e..642490f 100755 (executable)
@@ -13,7 +13,6 @@ import sha
 import hmac
 import datetime
 
 import hmac
 import datetime
 
-print 'Content-Type: text/html\n'
 sys.stderr = sys.stdout
 sys.path.append('/home/ecprice/.local/lib/python2.5/site-packages')
 
 sys.stderr = sys.stdout
 sys.path.append('/home/ecprice/.local/lib/python2.5/site-packages')
 
@@ -64,7 +63,10 @@ def validMachineName(name):
     charset = string.ascii_letters + string.digits + '-_'
     if name[0] in '-_' or len(name) > 22:
         return False
     charset = string.ascii_letters + string.digits + '-_'
     if name[0] in '-_' or len(name) > 22:
         return False
-    return all(x in charset for x in name)
+    for x in name:
+        if x not in charset:
+            return False
+    return True
 
 def kinit(username = 'tabbott/extra', keytab = '/etc/tabbott.keytab'):
     """Kinit with a given username and keytab"""
 
 def kinit(username = 'tabbott/extra', keytab = '/etc/tabbott.keytab'):
     """Kinit with a given username and keytab"""
@@ -541,10 +543,22 @@ if __name__ == '__main__':
         username = "moo"
         email = 'moo@cow.com'
     u = User()
         username = "moo"
         email = 'moo@cow.com'
     u = User()
+    if 'SSL_CLIENT_S_DN_Email' in os.environ:
+        username = os.environ[ 'SSL_CLIENT_S_DN_Email'].split("@")[0]
+        u.username = username
+        u.email = os.environ[ 'SSL_CLIENT_S_DN_Email']
+    else:
+        u.username = 'nobody'
+        u.email = None
+    connect('postgres://sipb-xen@sipb-xen-dev/sipb_xen')
     operation = os.environ.get('PATH_INFO', '')
     operation = os.environ.get('PATH_INFO', '')
+    #print 'Content-Type: text/plain\n'
+    #print operation
     if not operation:
     if not operation:
-        pass
-        #XXX do redirect
+        print "Status: 301 Moved Permanently"
+        print 'Location: ' + os.environ['SCRIPT_NAME']+'/\n'
+        sys.exit(0)
+    print 'Content-Type: text/html\n'
 
     if operation.startswith('/'):
         operation = operation[1:]
 
     if operation.startswith('/'):
         operation = operation[1:]