Changeset 600 for trunk/packages
- Timestamp:
- Jun 13, 2008, 3:42:51 AM (16 years ago)
- Location:
- trunk/packages/sipb-xen-www/code
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/sipb-xen-www/code/main.py
r599 r600 31 31 import atexit 32 32 atexit.register(printError) 33 sys.stderr = StringIO()34 33 35 34 sys.path.append('/home/ecprice/.local/lib/python2.5/site-packages') … … 119 118 DEFAULT_HEADERS = {'Content-Type': 'text/html'} 120 119 121 def error(op, username, fields, err, emsg ):120 def error(op, username, fields, err, emsg, traceback): 122 121 """Print an error page when a CodeError occurs""" 123 122 send_error_mail('xvm error on %s for %s: %s' % (op, username, err), 124 123 'error on %s for %s: %s\n\n%s\n' 125 124 % (op, username, err, emsg)) 126 d = dict(op=op, user=username, errorMessage=str(err),127 stderr=emsg)125 d = dict(op=op, user=username, fields=fields, 126 errorMessage=str(err), stderr=emsg, traceback=traceback) 128 127 return templates.error(searchList=[d]) 129 128 … … 637 636 638 637 def __iter__(self): 638 sys.stderr = StringIO() 639 639 fields = cgi.FieldStorage(fp=self.environ['wsgi.input'], environ=self.environ) 640 print >> sys.stderr, fields641 640 operation = self.environ.get('PATH_INFO', '') 642 641 if not operation: … … 677 676 checkpoint.checkpoint('output as a string') 678 677 except Exception, err: 678 import traceback 679 679 if not fields.has_key('js'): 680 680 if isinstance(err, CodeError): 681 681 self.start('500 Internal Server Error', [('Content-Type', 'text/html')]) 682 682 e = revertStandardError() 683 s = error(operation, self.username, fields, err, e) 683 s = error(operation, self.username, fields, 684 err, e, traceback.format_exc()) 684 685 yield str(s) 685 686 return … … 690 691 return 691 692 self.start('500 Internal Server Error', [('Content-Type', 'text/plain')]) 692 import traceback693 693 send_error_mail('xvm error: %s' % (err,), 694 694 '%s\n' % (traceback.format_exc(),)) -
trunk/packages/sipb-xen-www/code/templates/error.tmpl
r599 r600 17 17 <pre> 18 18 Error on operation $op for user $user: $errorMessage 19 Error output (if any): 20 $stderr 19 20 Fields: 21 #for $f in $fields: 22 $f=$fields[$f].value 23 #end for 24 25 Error output: 26 $stderr#slurp 27 ---- end error output 28 29 Traceback: 30 $traceback 21 31 </pre> 22 32 #end def
Note: See TracChangeset
for help on using the changeset viewer.