Skip to content

Commit

Permalink
feat: compatibility fixes for vds vNext
Browse files Browse the repository at this point in the history
BREAKING CHANGE: compatibility fixes for vds vNext
  • Loading branch information
jrdh committed Sep 16, 2024
1 parent c1c3a37 commit 5200591
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ckanext/iiif/builders/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def match_and_build(self, identifier: str) -> Optional[dict]:
raise IIIFBuildError(identifier, f'Resource {resource_id} not found')

try:
result = toolkit.get_action('record_show')(
result = toolkit.get_action("vds_data_get")(
{}, {'resource_id': resource_id, 'record_id': record_id}
)
# we're only going to use the data part
Expand Down
16 changes: 7 additions & 9 deletions ckanext/iiif/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,20 @@ def get_blueprint(self):
"""
return routes.blueprints

def datastore_multisearch_modify_response(self, response):
def vds_after_multi_query(self, response, result):
"""
IVersionedDatastore hook.
Only used if ckanext-versioned-datastore is installed.
"""
resource_cache = {}
resource_show = toolkit.get_action('resource_show')
resource_show = toolkit.get_action("resource_show")

for record in response['records']:
resource_id = record['resource']
for record in result["records"]:
resource_id = record["resource"]
if resource_id not in resource_cache:
resource_cache[resource_id] = resource_show({}, {'id': resource_id})
resource_cache[resource_id] = resource_show({}, {"id": resource_id})
with suppress(Exception):
record['iiif'] = RecordManifestBuilder.build_record_manifest(
resource_cache[resource_id], record['data']
record["iiif"] = RecordManifestBuilder.build_record_manifest(
resource_cache[resource_id], record["data"]
)

return response

0 comments on commit 5200591

Please sign in to comment.