Skip to content

Commit

Permalink
Plugins tested
Browse files Browse the repository at this point in the history
  • Loading branch information
ferag committed Nov 5, 2024
1 parent c6c0a6b commit c59b878
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions plugins/oai-pmh/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def __init__(
self.config = config
self.name = name
self.lang = lang
self.oai_base = api_endpoint
super().__init__(item_id, self.oai_base, self.lang, self.config, self.name)
self.api_endpoint = api_endpoint
super().__init__(item_id, self.api_endpoint, self.lang, self.config, self.name)
logger.debug("Using FAIR-EVA's plugin: %s" % self.name)
global _
_ = super().translation()
Expand Down Expand Up @@ -188,9 +188,13 @@ def oai_request(self, oai_base, action):
return xmlTree

def get_metadata(self):
logger.debug("OAI_BASE IN evaluator: %s" % self.oai_base)
if self.oai_base is not None and self.oai_base != "" and self.metadata is None:
metadataFormats = self.oai_metadataFormats(self.oai_base)
logger.debug("OAI_BASE IN evaluator: %s" % self.api_endpoint)
if (
self.api_endpoint is not None
and self.api_endpoint != ""
and self.metadata is None
):
metadataFormats = self.oai_metadataFormats(self.api_endpoint)
dc_prefix = ""
for e in metadataFormats:
if metadataFormats[e] == "http://www.openarchives.org/OAI/2.0/oai_dc/":
Expand All @@ -205,7 +209,9 @@ def get_metadata(self):
logger.debug("Trying to get metadata")
try:
item_metadata = self.oai_get_metadata(
self.oai_check_record_url(self.oai_base, dc_prefix, self.item_id)
self.oai_check_record_url(
self.api_endpoint, dc_prefix, self.item_id
)
).find(".//{http://www.openarchives.org/OAI/2.0/}metadata")
except Exception as e:
logger.error("Problem getting metadata: %s" % e)
Expand Down

0 comments on commit c59b878

Please sign in to comment.