Skip to content

Commit

Permalink
Merge pull request #226 from B2SHARE/record/inexisting-#224
Browse files Browse the repository at this point in the history
fixed #224: returning 404 for invalid record ids
  • Loading branch information
llehtine committed Apr 3, 2014
2 parents 4c1e38c + 4a6e287 commit 89de9b5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion invenio/lib/record_blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ def request_record(f):
def decorated(recid, *args, **kwargs):
# ensure recid to be integer
recid = int(recid)

from invenio.search_engine import record_exists, get_merged_recid
if record_exists(recid) == 0:
# record doesn't exist
abort(apache.HTTP_NOT_FOUND) # The record is gone!

g.collection = collection = Collection.query.filter(
Collection.name == guess_primary_collection_of_a_record(recid)).\
one()
Expand All @@ -82,7 +88,6 @@ def decorated(recid, *args, **kwargs):
abort(apache.HTTP_UNAUTHORIZED)

from invenio.bibfield import get_record
from invenio.search_engine import record_exists, get_merged_recid
# check if the current record has been deleted
# and has been merged, case in which the deleted record
# will be redirect to the new one
Expand Down

0 comments on commit 89de9b5

Please sign in to comment.