3
2
forked from Dniel97/artemis

fix comparability with python 8.7 - 3.10

This commit is contained in:
Hay1tsme 2023-11-19 01:05:34 -05:00
parent 0422a2bfd4
commit e7f35db3a4
2 changed files with 14 additions and 10 deletions

View File

@ -1,7 +1,6 @@
from twisted.web.http import Request from twisted.web.http import Request
import traceback import traceback
from twisted.web import resource, server import sys
from twisted.internet import reactor, endpoints
import yaml import yaml
import json import json
import re import re
@ -190,9 +189,10 @@ class CxbServlet(BaseServlet):
except Exception as e: except Exception as e:
self.logger.error(f"Error handling request for file {filetype} - {e}") self.logger.error(f"Error handling request for file {filetype} - {e}")
if self.logger.level == logging.DEBUG: if self.logger.level == logging.DEBUG:
traceback.print_exception(e, limit=1) tp, val, tb = sys.exc_info()
traceback.print_exception(tp, val, tb, limit=1)
with open("{0}/{1}.log".format(self.core_cfg.server.log_dir, "cxb"), "a") as f: with open("{0}/{1}.log".format(self.core_cfg.server.log_dir, "cxb"), "a") as f:
traceback.print_exception(e, limit=1, file=f) traceback.print_exception(tp, val, tb, limit=1, file=f)
return "" return ""
self.logger.debug(f"{version_string} Response {resp}") self.logger.debug(f"{version_string} Response {resp}")
@ -218,9 +218,10 @@ class CxbServlet(BaseServlet):
except Exception as e: except Exception as e:
self.logger.error(f"Error handling action {subcmd} request - {e}") self.logger.error(f"Error handling action {subcmd} request - {e}")
if self.logger.level == logging.DEBUG: if self.logger.level == logging.DEBUG:
traceback.print_exception(e, limit=1) tp, val, tb = sys.exc_info()
traceback.print_exception(tp, val, tb, limit=1)
with open("{0}/{1}.log".format(self.core_cfg.server.log_dir, "cxb"), "a") as f: with open("{0}/{1}.log".format(self.core_cfg.server.log_dir, "cxb"), "a") as f:
traceback.print_exception(e, limit=1, file=f) traceback.print_exception(tp, val, tb, limit=1, file=f)
return "" return ""
self.logger.debug(f"Response {resp}") self.logger.debug(f"Response {resp}")
@ -246,9 +247,10 @@ class CxbServlet(BaseServlet):
except Exception as e: except Exception as e:
self.logger.error(f"Error handling auth {subcmd} request - {e}") self.logger.error(f"Error handling auth {subcmd} request - {e}")
if self.logger.level == logging.DEBUG: if self.logger.level == logging.DEBUG:
traceback.print_exception(e, limit=1) tp, val, tb = sys.exc_info()
traceback.print_exception(tp, val, tb, limit=1)
with open("{0}/{1}.log".format(self.core_cfg.server.log_dir, "cxb"), "a") as f: with open("{0}/{1}.log".format(self.core_cfg.server.log_dir, "cxb"), "a") as f:
traceback.print_exception(e, limit=1, file=f) traceback.print_exception(tp, val, tb, limit=1, file=f)
return "" return ""
self.logger.debug(f"Response {resp}") self.logger.debug(f"Response {resp}")

View File

@ -8,6 +8,7 @@ from twisted.web.http import Request
from typing import Dict, Tuple, List from typing import Dict, Tuple, List
from os import path from os import path
import traceback import traceback
import sys
from core import CoreConfig, Utils from core import CoreConfig, Utils
from .config import WaccaConfig from .config import WaccaConfig
@ -185,9 +186,10 @@ class WaccaServlet:
f"{req.appVersion} Error handling method {url_path} -> {e}" f"{req.appVersion} Error handling method {url_path} -> {e}"
) )
if self.logger.level == logging.DEBUG: if self.logger.level == logging.DEBUG:
traceback.print_exception(e, limit=1) tp, val, tb = sys.exc_info()
traceback.print_exception(tp, val, tb, limit=1)
with open("{0}/{1}.log".format(self.core_cfg.server.log_dir, "wacca"), "a") as f: with open("{0}/{1}.log".format(self.core_cfg.server.log_dir, "wacca"), "a") as f:
traceback.print_exception(e, limit=1, file=f) traceback.print_exception(tp, val, tb, limit=1, file=f)
resp = BaseResponse() resp = BaseResponse()
resp.status = 1 resp.status = 1