Skip to content

Commit

Permalink
fixed saving / loading resources in JSON format
Browse files Browse the repository at this point in the history
  • Loading branch information
demjanp committed Dec 9, 2022
1 parent 1ace085 commit ef606a7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def finalize_options(self):

setup(
name="deposit",
version="1.4.33",
version="1.4.35",
description="Graph database focused on scientific data collection.",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
4 changes: 2 additions & 2 deletions src/deposit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version_info = (1, 4, 33)
version_info = (1, 4, 35)

__version__ = '.'.join(map(str, version_info))
__title__ = 'Deposit'
__date__ = "21.11.2022"
__date__ = "9.12.2022"

from deposit.store.store import Store

Expand Down
13 changes: 13 additions & 0 deletions src/deposit/utils/fnc_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,13 @@ def _as_key(obj_id, is_json):
if "queries" in data:
store._queries = data["queries"]

store._resources = {}
for obj in store.get_objects():
for name in obj.get_descriptor_names():
descr = obj.get_descriptor(name)
if isinstance(descr, DResource):
store._resources[descr.url] = descr

return True

def json_data_to_store(data, store, progress = None):
Expand Down Expand Up @@ -329,6 +336,12 @@ def json_data_to_store(data, store, progress = None):
store._user_tools = data["user_tools"]
store._queries = data["queries"]
store._local_folder = data["local_folder"]
store._resources = {}
for obj in store.get_objects():
for name in obj.get_descriptor_names():
descr = obj.get_descriptor(name)
if isinstance(descr, DResource):
store._resources[descr.url] = descr

if progress is not None:
progress.update_state(value = cmax, maximum = cmax)
Expand Down

0 comments on commit ef606a7

Please sign in to comment.