projects
/
invirt/packages/invirt-web.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Expose the script to kill the fastcgi processes.
[invirt/packages/invirt-web.git]
/
code
/
main.py
diff --git
a/code/main.py
b/code/main.py
index
ec14236
..
d05eaca
100755
(executable)
--- a/
code/main.py
+++ b/
code/main.py
@@
-6,7
+6,6
@@
import cPickle
import cgi
import datetime
import hmac
import cgi
import datetime
import hmac
-import os
import sha
import simplejson
import sys
import sha
import simplejson
import sys
@@
-262,7
+261,7
@@
def vnc(username, state, fields):
on=status,
has_vnc=has_vnc,
machine=machine,
on=status,
has_vnc=has_vnc,
machine=machine,
- hostname=os.environ.get('SERVER_NAME', 'localhost'),
+ hostname=state.environ.get('SERVER_NAME', 'localhost'),
authtoken=token)
return templates.vnc(searchList=[d])
authtoken=token)
return templates.vnc(searchList=[d])
@@
-340,7
+339,7
@@
def command(username, state, fields):
return templates.list(searchList=[d])
elif back == 'info':
machine = validation.Validate(username, state, machine_id=fields.getfirst('machine_id')).machine
return templates.list(searchList=[d])
elif back == 'info':
machine = validation.Validate(username, state, machine_id=fields.getfirst('machine_id')).machine
- return ({'Status': '302',
+ return ({'Status': '303 See Other',
'Location': '/info?machine_id=%d' % machine.machine_id},
"You shouldn't see this message.")
else:
'Location': '/info?machine_id=%d' % machine.machine_id},
"You shouldn't see this message.")
else:
@@
-378,7
+377,7
@@
def modifyDict(username, state, fields):
machine.owner = validate.owner
update_acl = True
if hasattr(validate, 'name'):
machine.owner = validate.owner
update_acl = True
if hasattr(validate, 'name'):
- machine.name = name
+ machine.name = validate.name
if hasattr(validate, 'admin') and validate.admin != machine.administrator:
machine.administrator = validate.admin
update_acl = True
if hasattr(validate, 'admin') and validate.admin != machine.administrator:
machine.administrator = validate.admin
update_acl = True
@@
-412,7
+411,7
@@
def modify(username, state, fields):
machine = modify_dict['machine']
result = 'Success!'
err = None
machine = modify_dict['machine']
result = 'Success!'
err = None
- info_dict = infoDict(username, machine)
+ info_dict = infoDict(username, state, machine)
info_dict['err'] = err
if err:
for field in fields.keys():
info_dict['err'] = err
if err:
for field in fields.keys():
@@
-612,6
+611,7
@@
class App:
self.username = getUser(environ)
self.state = State(self.username)
self.username = getUser(environ)
self.state = State(self.username)
+ self.state.environ = environ
def __iter__(self):
fields = cgi.FieldStorage(fp=self.environ['wsgi.input'], environ=self.environ)
def __iter__(self):
fields = cgi.FieldStorage(fp=self.environ['wsgi.input'], environ=self.environ)
@@
-619,7
+619,7
@@
class App:
operation = self.environ.get('PATH_INFO', '')
if not operation:
self.start("301 Moved Permanently", [('Location',
operation = self.environ.get('PATH_INFO', '')
if not operation:
self.start("301 Moved Permanently", [('Location',
- os.environ['SCRIPT_NAME']+'/')])
+ self.environ['SCRIPT_NAME']+'/')])
return
if self.username is None:
operation = 'unauth'
return
if self.username is None:
operation = 'unauth'
@@
-675,7
+675,9
@@
Please email xvm-dev@mit.edu with the contents of this page.'
----
%s
----''' % (str(err), traceback.format_exc())
----
%s
----''' % (str(err), traceback.format_exc())
- self.start('200 OK', headers.items())
+ status = headers.setdefault('Status', '200 OK')
+ del headers['Status']
+ self.start(status, headers.items())
yield output_string
if fields.has_key('timedebug'):
yield '<pre>%s</pre>' % cgi.escape(str(checkpoint))
yield output_string
if fields.has_key('timedebug'):
yield '<pre>%s</pre>' % cgi.escape(str(checkpoint))