Esempio n. 1
0
 def make_response(self, rv):
     if not rv:
         rv = Response('')
     elif not isinstance(rv, (BaseResponse, Exception)):
         template_name, payload = rv
         payload['marketplace_uri'] = self.marketplace_uri
         rv = render(template_name, request, **payload)
     return super(RentMyBike, self).make_response(rv)
Esempio n. 2
0
 def make_response(self, rv):
     if not rv:
         rv = Response('')
     elif not isinstance(rv, (BaseResponse, Exception)):
         template_name, payload = rv
         payload['marketplace_uri'] = self.marketplace_uri
         rv = render(template_name, request, **payload)
     return super(RentMyBike, self).make_response(rv)
Esempio n. 3
0
 def error_handler(self, ex):
     try:
         Session.rollback()
     except InterfaceError as ex:
         if not ex.connection_invalidated:
             logger.exception(ex)
             raise
     logger.exception(ex)
     ex_type = sys.exc_info()[0]
     ex_tb = sys.exc_info()[2]
     fmt_tb = traceback.format_exception(ex_type, ex, ex_tb)
     encoded_tb = [unicode(l, 'utf-8') for l in fmt_tb]
     tb = ''.join(encoded_tb)
     ex.traceback = tb
     response = render('error.mako', request, exception=ex, status_code=500)
     return response
Esempio n. 4
0
 def error_handler(self, ex):
     try:
         Session.rollback()
     except InterfaceError as ex:
         if not ex.connection_invalidated:
             logger.exception(ex)
             raise
     logger.exception(ex)
     ex_type = sys.exc_info()[0]
     ex_tb = sys.exc_info()[2]
     fmt_tb = traceback.format_exception(ex_type, ex, ex_tb)
     encoded_tb = [unicode(l, 'utf-8') for l in fmt_tb]
     tb = ''.join(encoded_tb)
     ex.traceback = tb
     response = render('error.mako', request, exception=ex, status_code=500)
     return response