def _exec(self): """with退出处理 """ try: self._args_set() except ValueError as e: log_format(self, error_info=e) msg = "参数错误,请检查参数后再请求! {}".format(e) return self.send_obj({"status": 1000, "msg": msg}) try: res = self.response() except OperationalError as e: # Mysql 连接错误 log.warning("Mysql OperationalError: %s", e) reconnect() # 如果连接失败重新加载当前请求页面 return self.redirect(self.request.uri) except Exception: import traceback e = traceback.format_exc() log.error("Internal Error: %s", e) return self.send_obj({"status": 10001, "msg": str(e)}) if not self._finished: return self.send_obj(res)
def _exec(self): '''with退出处理 ''' try: self._args_set() except ValueError as e: log_format(self, error_info=e) msg = "参数错误,请检查参数后再请求! {}".format(e) return self.send_obj({'status': 1000, 'msg': msg}) try: clz = self.__class__.__name__ if clz == 'LoginMainHandler' or clz == 'LogoutMainHandler': res = self.response() elif self.current_user == None: return self.render('login.html', message='') else: res = self.response() except Exception: import traceback e = traceback.format_exc() log.error('Internal Error: %s', e) return self.send_obj({'status': 10001, 'msg': str(e)}) if not self._finished: return self.send_obj(res)
def _exec(self): '''with退出处理 ''' try: self._args_set() except ValueError as e: log_format(self, error_info=e) msg = "参数错误,请检查参数后再请求! {}".format(e) return self.send_obj({'status': 1000, 'msg': msg}) try: res = self.response() except Exception: import traceback e = traceback.format_exc() log.error('Internal Error: %s', e) return self.send_obj({'status': 10001, 'msg': str(e)}) if not self._finished: return self.send_obj(res)
def _exec(self): '''with退出处理 ''' try: self._args_set() except ValueError as e: log_format(self, error_info=e) msg = "参数错误,请检查参数后再请求! {}".format(e) return self.send_obj({'status': 1000, 'msg': msg}) try: res = self.response() except OperationalError as e: # Mysql 连接错误 log.warning('Mysql OperationalError: %s', e) reconnect() # 如果连接失败重新加载当前请求页面 return self.redirect(self.request.uri) except Exception: import traceback e = traceback.format_exc() log.error('Internal Error: %s', e) return self.send_obj({'status': 10001, 'msg': str(e)}) if not self._finished: return self.send_obj(res)