X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/blobdiff_plain/daa95318e6cee597593b33f77a99cd224c8be893..60e6df8b7ee5e0cb1a700a62bd4c6daca6520bb9:/code/main.py diff --git a/code/main.py b/code/main.py index 2740a74..7513973 100755 --- a/code/main.py +++ b/code/main.py @@ -11,6 +11,7 @@ import simplejson import sys import time import urllib +import random from StringIO import StringIO def revertStandardError(): @@ -341,7 +342,7 @@ def command(username, state, path, fields): elif back == 'info': machine = validation.Validate(username, state, machine_id=fields.getfirst('machine_id')).machine return ({'Status': '303 See Other', - 'Location': '/info?machine_id=%d' % machine.machine_id}, + 'Location': 'info?machine_id=%d' % machine.machine_id}, "You shouldn't see this message.") else: raise InvalidInput('back', back, 'Not a known back page.') @@ -585,6 +586,10 @@ def unauthFront(_, _2, _3, fields): return templates.unauth(searchList=[{'simple' : True}]) def overlord(username, state, path, fields): + if path == '': + return ({'Status': '303 See Other', + 'Location': 'overlord/'}, + "You shouldn't see this message.") if not username in getAfsGroupMembers('system:xvm', 'athena.mit.edu'): raise InvalidInput('username', username, 'Not an overlord.') newstate = State(username, overlord=True) @@ -659,6 +664,8 @@ class App: self.state = State(self.username) self.state.environ = environ + random.seed() #sigh + def __iter__(self): start_time = time.time() sipb_xen_database.clear_cache() @@ -666,8 +673,7 @@ class App: fields = cgi.FieldStorage(fp=self.environ['wsgi.input'], environ=self.environ) operation = self.environ.get('PATH_INFO', '') if not operation: - self.start("301 Moved Permanently", [('Location', - self.environ['SCRIPT_NAME']+'/')]) + self.start("301 Moved Permanently", [('Location', './')]) return if self.username is None: operation = 'unauth'