|
@@ -19,6 +19,8 @@ from tornado.escape import json_decode, json_encode, url_escape
|
|
|
from threading import Timer
|
|
|
import subprocess
|
|
|
|
|
|
+python_version = sys.version_info.major
|
|
|
+
|
|
|
root = os.path.dirname(__file__)
|
|
|
|
|
|
|
|
@@ -104,6 +106,10 @@ def fetchDataADEI():
|
|
|
data = requests.get(url,
|
|
|
auth=(os.environ["BORA_ADEI_USERNAME"],
|
|
|
os.environ["BORA_ADEI_PASSWORD"])).content
|
|
|
+
|
|
|
+ if python_version == 3:
|
|
|
+ data = data.decode("utf-8")
|
|
|
+
|
|
|
if data == "":
|
|
|
logger.info(str(param) + ': Empty data!')
|
|
|
continue
|
|
@@ -181,9 +187,9 @@ class DesignerHandler(tornado.web.RequestHandler):
|
|
|
except yaml.YAMLError as exc:
|
|
|
print(exc)
|
|
|
|
|
|
- with open("style.yaml", 'r') as stream:
|
|
|
+ with open("style.yaml", 'r') as stream2:
|
|
|
try:
|
|
|
- style_data = yaml.load(stream)
|
|
|
+ style_data = yaml.load(stream2)
|
|
|
except yaml.YAMLError as exc:
|
|
|
print(exc)
|
|
|
|
|
@@ -192,7 +198,8 @@ class DesignerHandler(tornado.web.RequestHandler):
|
|
|
else:
|
|
|
index_data = cache_data
|
|
|
|
|
|
- if index_data is not None: index_data = sorted(index_data)
|
|
|
+ if index_data is not None:
|
|
|
+ index_data = sorted(index_data)
|
|
|
|
|
|
data = {
|
|
|
"cache": cache_data,
|
|
@@ -228,7 +235,10 @@ class SaveHandler(tornado.web.RequestHandler):
|
|
|
json_obj = json_decode(self.request.body)
|
|
|
|
|
|
with open("style.yaml", 'w') as output:
|
|
|
- output.write(yaml.safe_dump(json_obj, encoding='utf-8',
|
|
|
+ if python_version == 3:
|
|
|
+ output.write(yaml.safe_dump(json_obj, allow_unicode=True, default_flow_style=False))
|
|
|
+ else:
|
|
|
+ output.write(yaml.safe_dump(json_obj, encoding='utf-8',
|
|
|
allow_unicode=True, default_flow_style=False))
|
|
|
response = {"success": "Data entry inserted."}
|
|
|
|
|
@@ -308,6 +318,11 @@ class UpdateHandler(tornado.web.RequestHandler):
|
|
|
data = requests.get(url, auth=(os.environ["BORA_ADEI_USERNAME"],
|
|
|
os.environ["BORA_ADEI_PASSWORD"]))
|
|
|
cr = data.content
|
|
|
+
|
|
|
+
|
|
|
+ if python_version == 3:
|
|
|
+ cr = cr.decode("utf-8")
|
|
|
+
|
|
|
cr = cr.split(",")
|
|
|
|
|
|
match_token = item
|
|
@@ -378,6 +393,10 @@ class AdeiKatrinHandler(tornado.web.RequestHandler):
|
|
|
os.environ["BORA_ADEI_PASSWORD"])
|
|
|
)
|
|
|
cr = data.content
|
|
|
+
|
|
|
+ if python_version == 3:
|
|
|
+ cr = cr.decode("utf-8")
|
|
|
+
|
|
|
cr = cr.splitlines()
|
|
|
cr = ",".join(cr)
|
|
|
cr = cr.split(",")
|