3
11

Extensions: use a new structure for the server's JSON listing #29

Closed
Campbell Barton wants to merge 4 commits from test-refactor-server-json into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit 4dedda8465 - Show all commits

View File

@ -805,7 +805,24 @@ class _RepoCacheEntry:
with open(filepath_json, "w", encoding="utf-8") as fh: with open(filepath_json, "w", encoding="utf-8") as fh:
# Indent because it can be useful to check this file if there are any issues. # Indent because it can be useful to check this file if there are any issues.
fh.write(json.dumps(local_json_data, indent=2))
# Begin: transform to list with ID's in item.
# TODO: this transform can probably be removed and the internal format can change
# to use the same structure as the actual JSON.
local_json_data_as_list = []
local_json_data_compat = {
"version": "v1",
"blocklist": [],
"data": local_json_data_as_list,
}
local_json_data_as_list[:] = [
{"id": pkg_idname, **value}
for pkg_idname, value in local_json_data.items()
]
# End: compatibility change.
fh.write(json.dumps(local_json_data_compat, indent=2))
def _json_data_refresh( def _json_data_refresh(
self, self,