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 7ee3c921b8 - Show all commits

View File

@ -1025,7 +1025,12 @@ class RepoCacheStore:
yield None yield None
else: else:
for item_remote in json_items: for item_remote in json_items:
pkg_manifest_remote[item_remote.pop("id")] = item_remote # TODO(@ideasman42): we may want to include the "id", as part of moving to a new format
ideasman42 marked this conversation as resolved Outdated

For this to work I had to create a copy:

-                    for item_remote in json_items:
+                    for item_remote_iter in json_item:
+                        # Create copy otherwise we will be editing original data.
+                        item_remote = item_remote_iter.copy()

I didn't investigate on why it happens, but it does happen.

For this to work I had to create a copy: ```diff - for item_remote in json_items: + for item_remote_iter in json_item: + # Create copy otherwise we will be editing original data. + item_remote = item_remote_iter.copy() ``` I didn't investigate on why it happens, but it does happen.

Pushed similar fix with comment, strange I didn't run into this when testing.

Pushed similar fix with comment, strange I didn't run into this when testing.
# the "id" used not to be part of each item so users of this API assume it's not.
# The `item_remote` could be used in-place however that needs further testing.
item_remove_copy = item_remote.copy()
pkg_idname = item_remove_copy.pop("id")
pkg_manifest_remote[pkg_idname] = item_remove_copy
yield pkg_manifest_remote yield pkg_manifest_remote
def pkg_manifest_from_local_ensure( def pkg_manifest_from_local_ensure(