thirdparty/google_appengine/google/appengine/ext/webapp/__init__.py
changeset 828 f5fd65cc3bf3
parent 297 35211afcd563
child 2273 e4cb9c53db3e
equal deleted inserted replaced
827:88c186556a80 828:f5fd65cc3bf3
   377     Args:
   377     Args:
   378       exception: the exception that was thrown
   378       exception: the exception that was thrown
   379       debug_mode: True if the web application is running in debug mode
   379       debug_mode: True if the web application is running in debug mode
   380     """
   380     """
   381     self.error(500)
   381     self.error(500)
   382     lines = ''.join(traceback.format_exception(*sys.exc_info()))
   382     logging.exception(exception)
   383     logging.error(lines)
       
   384     if debug_mode:
   383     if debug_mode:
       
   384       lines = ''.join(traceback.format_exception(*sys.exc_info()))
   385       self.response.clear()
   385       self.response.clear()
   386       self.response.headers['Content-Type'] = 'text/plain'
   386       self.response.out.write('<pre>%s</pre>' % (cgi.escape(lines, quote=True)))
   387       self.response.out.write(lines)
       
   388 
   387 
   389   @classmethod
   388   @classmethod
   390   def get_url(cls, *args, **kargs):
   389   def get_url(cls, *args, **kargs):
   391     """Returns the url for the given handler.
   390     """Returns the url for the given handler.
   392 
   391