Fix content.json update and verify on Python 3.5
This commit is contained in:
parent
0a1c22530a
commit
77530f13ee
2 changed files with 6 additions and 2 deletions
|
@ -4,6 +4,7 @@ import re
|
||||||
import os
|
import os
|
||||||
import copy
|
import copy
|
||||||
import base64
|
import base64
|
||||||
|
import sys
|
||||||
|
|
||||||
import gevent
|
import gevent
|
||||||
|
|
||||||
|
@ -901,7 +902,10 @@ class ContentManager(object):
|
||||||
if type(file) is dict:
|
if type(file) is dict:
|
||||||
new_content = file
|
new_content = file
|
||||||
else:
|
else:
|
||||||
new_content = json.load(file)
|
if sys.version_info.major == 3 and sys.version_info.minor < 6:
|
||||||
|
new_content = json.loads(file.read().decode("utf8"))
|
||||||
|
else:
|
||||||
|
new_content = json.load(file)
|
||||||
if inner_path in self.contents:
|
if inner_path in self.contents:
|
||||||
old_content = self.contents.get(inner_path, {"modified": 0})
|
old_content = self.contents.get(inner_path, {"modified": 0})
|
||||||
# Checks if its newer the ours
|
# Checks if its newer the ours
|
||||||
|
|
|
@ -117,7 +117,7 @@ class FileRequest(object):
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
content = json.loads(params["body"])
|
content = json.loads(params["body"].decode())
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
self.log.debug("Update for %s is invalid JSON: %s" % (inner_path, err))
|
self.log.debug("Update for %s is invalid JSON: %s" % (inner_path, err))
|
||||||
self.response({"error": "File invalid JSON"})
|
self.response({"error": "File invalid JSON"})
|
||||||
|
|
Loading…
Reference in a new issue