Skip to content

Commit

Permalink
legacy: Rename migration/ to legacy/
Browse files Browse the repository at this point in the history
  • Loading branch information
sakshamarora1 authored and zzacharo committed Nov 5, 2024
1 parent bbbb80c commit d99165b
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 5 deletions.
8 changes: 8 additions & 0 deletions site/cds_rdm/legacy/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2024 CERN.
#
# CDS-RDM is free software; you can redistribute it and/or modify it under
# the terms of the MIT License; see LICENSE file for more details.

"""CDS-RDM legacy migration module."""
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ class VersionNotFound(Exception):
"""Error for when the specific version of a record is not found."""

def __init__(self, version, latest_record):
"""Initialise error."""
self.version = version
self.latest_record = latest_record
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ def get_pid_by_legacy_recid(legacy_recid):
"""Get record by pid value."""
# Get the object uuid from pidstore
recid = PersistentIdentifier.query.filter_by(
pid_value=legacy_recid, pid_type="lrecid"
pid_value=legacy_recid, object_type="rec", pid_type="lrecid"
).one()

# Use the object uuid to get the parent pid value
parent_pid = PersistentIdentifier.query.filter_by(
object_uuid=recid.object_uuid, pid_type="recid"
object_uuid=recid.object_uuid, object_type="rec", pid_type="recid"
).one()

return parent_pid.pid_value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@

{% block message %}
<h1><i class="bolt icon"></i> {{_('Version not found')}}</h1>
<p>{{_('We could not find version %s of the requested file. Click' | format(version)) }} <a href={{latest_record["links"]["self_html"]}}>{{_("here")}}</a> {{_('to check the files in the latest version of the record.')}}</p>
<p>{{_('We could not find version %s of the requested file. Click' | format(version)) }} <a href={{latest_record["links"]["self_html"]}}>{{_("here")}}</a> {{_('to see the files in the latest version of the record.')}}</p>
{% endblock message %}
4 changes: 2 additions & 2 deletions site/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ invenio_base.apps =
invenio_base.api_apps =
cds_rdm = cds_rdm:CDS_RDM_REST
invenio_base.blueprints =
cds_rdm_migration = cds_rdm.migration.redirector:create_blueprint
cds_rdm_migration = cds_rdm.legacy.redirector:create_blueprint
invenio_assets.webpack =
cds_rdm_theme = cds_rdm.webpack:theme
invenio_celery.tasks =
Expand All @@ -39,7 +39,7 @@ idutils.custom_schemes =
invenio_db.alembic =
cds_rdm = cds_rdm:alembic
invenio_db.models =
cds_migration_models = cds_rdm.migration.models
cds_migration_models = cds_rdm.legacy.models

[pydocstyle]
add_ignore = D401,D403
Expand Down
File renamed without changes.

0 comments on commit d99165b

Please sign in to comment.