Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iiif: moving iiif and fixing bugs #184

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion geo_rdm_records/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@

from .ext import GEORDMRecords

__version__ = "0.8.0.dev0"
__version__ = "0.8.0.dev1"
__all__ = ("__version__", "GEORDMRecords")
2 changes: 1 addition & 1 deletion geo_rdm_records/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

RDM_REVIEW_SERVICE = "geo_rdm_records.modules.rdm.services.review.service.ReviewService"

RDM_IIIF_SERVICE = "geo_rdm_records.modules.rdm.services.iiif.service.IIIFService"
RDM_IIIF_SERVICE = "geo_rdm_records.modules.iiif.service.IIIFService"

# Configuration
RDM_RECORD_SERVICE_CFG = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2022 Geo Secretariat.
# Copyright (C) 2022-2024 GEO Secretariat.
#
# geo-rdm-records is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2022 Geo Secretariat.
# Copyright (C) 2022-2024 GEO Secretariat.
#
# geo-rdm-records is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand All @@ -14,12 +14,7 @@


class IIIFService(BaseIIIFService):
"""IIIF service.

ToDo:
We are just starting with this component. In a near future we will
revise this approach to improve the way we delivery IIIF APIs.
"""
"""IIIF service."""

modes = {"record": ["record", "draft"], "package": ["package", "package-draft"]}
"""Service operation mode."""
Expand Down Expand Up @@ -48,7 +43,7 @@ def _get_mode_type(self, type_):
mode_types = self.modes_type[mode]

for mode_type in mode_types:
if mode in mode_types[mode_type]:
if type_ in mode_types[mode_type]:
return mode_type

def _get_service(self, type_):
Expand All @@ -59,7 +54,7 @@ def _get_service(self, type_):
def file_service(self, type_):
"""Get the correct instance of the file service, draft vs record."""
service = self._get_service(type_)
mode_type = self._get_mode(type_)
mode_type = self._get_mode_type(type_)

return service.files if mode_type == "record" else service.draft_files

Expand All @@ -69,11 +64,14 @@ def read_record(self, identity, uuid):

# Defining the operation mode of the service.
service = self._get_service(type_)
mode_type = self._get_mode(type_)
mode_type = self._get_mode_type(type_)

read = service.read if mode_type == "record" else service.read_draft
record = read(identity=identity, id_=id_)

file_service = self.file_service(type_)
files = file_service.list_files(identity=identity, id_=id_)

record.files = files

return record
Loading