Skip to content

Commit

Permalink
Merge pull request #184 from M3nin0/marketplace
Browse files Browse the repository at this point in the history
iiif: moving iiif and fixing bugs
  • Loading branch information
M3nin0 authored Feb 13, 2024
2 parents a894f54 + e63ee19 commit 3b9ecb6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
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

0 comments on commit 3b9ecb6

Please sign in to comment.