Skip to content

Commit

Permalink
Merge e040809 into 23b0031
Browse files Browse the repository at this point in the history
  • Loading branch information
Semtexcz authored Nov 25, 2020
2 parents 23b0031 + e040809 commit 92f9ff8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 13 additions & 6 deletions oarepo_oai_pmh_harvester/synchronization.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def create_record(self, data):
# Create persistent identifier
pid = minter(record_uuid, data=data)
# Create record
record = record_class.create(data, id_=record_uuid)
record = record_class.create(data, id_=pid.object_uuid)

db.session.commit()

Expand Down Expand Up @@ -373,19 +373,26 @@ def delete_record(self, oai_rec):
indexer_class().delete(record)

def get_endpoint_config(self, data):
end_point_name = None
endpoint_name = None
if not data:
data = {}
if self.endpoint_mapping:
end_point_name = self.endpoint_mapping["mapping"].get(
endpoint_name = self.endpoint_mapping["mapping"].get(
data.get(self.endpoint_mapping["field_name"]))
if not end_point_name and self.endpoint_handler:
if not endpoint_name and self.endpoint_handler:
provider = self.endpoint_handler.get(self.provider_code)
if provider:
handler = provider.get(self.metadata_prefix)
if handler:
end_point_name = handler(data)
endpoint_config = self.endpoints.get(end_point_name) or self.endpoints.get(
endpoint_name = handler(data)
draft_configs = current_app.config.get("RECORDS_DRAFT_ENDPOINTS")
if draft_configs:
draft_endpoint_config = draft_configs.get(endpoint_name)
if draft_endpoint_config:
draft_endpoint_name = draft_endpoint_config.get("draft")
if draft_endpoint_name:
endpoint_name = draft_endpoint_name
endpoint_config = self.endpoints.get(endpoint_name) or self.endpoints.get(
self.default_endpoint)
return endpoint_config

Expand Down
2 changes: 1 addition & 1 deletion oarepo_oai_pmh_harvester/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@

from __future__ import absolute_import, print_function

__version__ = '2.0.0a10'
__version__ = '2.0.0a11'

0 comments on commit 92f9ff8

Please sign in to comment.