Skip to content

Commit 5f5f141

Browse files
committed
Remove from_json_legacy
1 parent 8aab67d commit 5f5f141

File tree

1 file changed

+0
-31
lines changed

1 file changed

+0
-31
lines changed

gramps_webapi/api/util.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -775,37 +775,6 @@ def get_logger() -> logging.Logger:
775775
return logger
776776

777777

778-
def __object_hook(obj_dict):
779-
obj = getattr(gramps.gen.lib, obj_dict["_class"])()
780-
for key, value in obj_dict.items():
781-
if key != "_class":
782-
if key in ("dateval", "rect") and value is not None:
783-
value = tuple(value)
784-
if key == "ranges":
785-
value = [tuple(item) for item in value]
786-
setattr(obj, key, value)
787-
if obj_dict["_class"] == "Date":
788-
if obj.is_empty() and not obj.text:
789-
return None
790-
return obj
791-
792-
793-
def from_json_legacy(data):
794-
"""
795-
Decode JSON data into a Gramps object hierarchy.
796-
797-
:param data: The JSON string to be unserialized.
798-
:type data: str
799-
:returns: A Gramps object.
800-
:rtype: object
801-
802-
Note: this function was part of Gramps 5.x and is copied here because,
803-
unlike gramps.gen.lib.json_utils.data_to_object in Gramps 6.0, it does
804-
not require the dictionary to contain all properties.
805-
"""
806-
return json.loads(data, object_hook=__object_hook)
807-
808-
809778
def complete_gramps_object_dict(data: dict[str, Any]):
810779
"""Restore a JSON dictionary to its full form, adding placeholders
811780
for missing attributes."""

0 commit comments

Comments
 (0)