浏览代码

reed before commit

ash 2 年之前
父节点
当前提交
accbf8ebc4
共有 1 个文件被更改,包括 14 次插入2 次删除
  1. 14 2
      Backend/Sources/Model/model_manager.py

+ 14 - 2
Backend/Sources/Model/model_manager.py

@@ -1,5 +1,6 @@
 from pyexpat import model
 from sys import modules
+from tokenize import String
 from sqlalchemy.ext.declarative import DeclarativeMeta
 from sqlalchemy import null
 from utility.app_logging import *
@@ -110,6 +111,17 @@ def setModelItemAttributesFromJson(Item, JsonString):
         setattr(Item, key, attributes_dict[key])
 
 
-def ModelObjectToJsonString(object):
+def ModelObjectToJsonString(object) -> str:
 
-    return json.dumps(object, cls=ComplexEncoder)
+
+
+
+    json_string = json.dumps(object, cls=ComplexEncoder)
+    json_dict : dict = json.loads(json_string)
+    json_dict.pop("registry") # removing the registry item that comes from the sql alchemy type.
+    json_string = json.dumps(json_dict)
+
+    assert isinstance(json_string,str)
+
+
+    return json_string