From: Eric Price Date: Mon, 8 Oct 2007 07:39:40 +0000 (-0400) Subject: Python 2.4 support X-Git-Tag: sipb-xen-www/1~82 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/commitdiff_plain/1b25b61caba6e7aa2962028b71958863b689f592?hp=e0e7814e58df1dc0342e3f88e7bcfad4ed483079 Python 2.4 support svn path=/trunk/web/; revision=140 --- diff --git a/templates/VncViewer.jar b/templates/VncViewer.jar index 7d9d145..af710dc 100644 Binary files a/templates/VncViewer.jar and b/templates/VncViewer.jar differ diff --git a/templates/main.py b/templates/main.py index b528b3e..642490f 100755 --- a/templates/main.py +++ b/templates/main.py @@ -13,7 +13,6 @@ import sha 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') @@ -64,7 +63,10 @@ def validMachineName(name): 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""" @@ -541,10 +543,22 @@ if __name__ == '__main__': 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', '') + #print 'Content-Type: text/plain\n' + #print 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:]