svn path=/trunk/packages/sipb-xen-www/; revision=600
if __name__ == '__main__':
import atexit
atexit.register(printError)
if __name__ == '__main__':
import atexit
atexit.register(printError)
- sys.stderr = StringIO()
sys.path.append('/home/ecprice/.local/lib/python2.5/site-packages')
sys.path.append('/home/ecprice/.local/lib/python2.5/site-packages')
DEFAULT_HEADERS = {'Content-Type': 'text/html'}
DEFAULT_HEADERS = {'Content-Type': 'text/html'}
-def error(op, username, fields, err, emsg):
+def error(op, username, fields, err, emsg, traceback):
"""Print an error page when a CodeError occurs"""
send_error_mail('xvm error on %s for %s: %s' % (op, username, err),
'error on %s for %s: %s\n\n%s\n'
% (op, username, err, emsg))
"""Print an error page when a CodeError occurs"""
send_error_mail('xvm error on %s for %s: %s' % (op, username, err),
'error on %s for %s: %s\n\n%s\n'
% (op, username, err, emsg))
- d = dict(op=op, user=username, errorMessage=str(err),
- stderr=emsg)
+ d = dict(op=op, user=username, fields=fields,
+ errorMessage=str(err), stderr=emsg, traceback=traceback)
return templates.error(searchList=[d])
def invalidInput(op, username, fields, err, emsg):
return templates.error(searchList=[d])
def invalidInput(op, username, fields, err, emsg):
self.state.environ = environ
def __iter__(self):
self.state.environ = environ
def __iter__(self):
+ sys.stderr = StringIO()
fields = cgi.FieldStorage(fp=self.environ['wsgi.input'], environ=self.environ)
fields = cgi.FieldStorage(fp=self.environ['wsgi.input'], environ=self.environ)
- print >> sys.stderr, fields
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',
output_string = str(output)
checkpoint.checkpoint('output as a string')
except Exception, err:
output_string = str(output)
checkpoint.checkpoint('output as a string')
except Exception, err:
if not fields.has_key('js'):
if isinstance(err, CodeError):
self.start('500 Internal Server Error', [('Content-Type', 'text/html')])
e = revertStandardError()
if not fields.has_key('js'):
if isinstance(err, CodeError):
self.start('500 Internal Server Error', [('Content-Type', 'text/html')])
e = revertStandardError()
- s = error(operation, self.username, fields, err, e)
+ s = error(operation, self.username, fields,
+ err, e, traceback.format_exc())
yield str(s)
return
if isinstance(err, InvalidInput):
yield str(s)
return
if isinstance(err, InvalidInput):
yield str(invalidInput(operation, self.username, fields, err, e))
return
self.start('500 Internal Server Error', [('Content-Type', 'text/plain')])
yield str(invalidInput(operation, self.username, fields, err, e))
return
self.start('500 Internal Server Error', [('Content-Type', 'text/plain')])
send_error_mail('xvm error: %s' % (err,),
'%s\n' % (traceback.format_exc(),))
yield '''Uh-oh! We experienced an error.
send_error_mail('xvm error: %s' % (err,),
'%s\n' % (traceback.format_exc(),))
yield '''Uh-oh! We experienced an error.
<pre>
Error on operation $op for user $user: $errorMessage
<pre>
Error on operation $op for user $user: $errorMessage
-Error output (if any):
-$stderr
+
+Fields:
+#for $f in $fields:
+$f=$fields[$f].value
+#end for
+
+Error output:
+$stderr#slurp
+---- end error output
+
+Traceback:
+$traceback