Redirect overlord -> overlord/ and use relative redirects.
authorAnders Kaseorg <andersk@mit.edu>
Sun, 22 Jun 2008 02:51:38 +0000 (22:51 -0400)
committerAnders Kaseorg <andersk@mit.edu>
Sun, 22 Jun 2008 02:51:38 +0000 (22:51 -0400)
svn path=/trunk/packages/sipb-xen-www/; revision=633

code/main.py

index 2740a74..9d39df6 100755 (executable)
@@ -341,7 +341,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 +585,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)
@@ -666,8 +670,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'