From: olivier <> Date: Thu, 9 Apr 2009 19:14:07 +0000 (+0000) Subject: #67: report oai-pmh errors instead of raising an exception for malformed identifiers X-Git-Tag: 1.1~685 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=151d2d6be40c05e63669882734f8ff24efb622dc;p=telemeta.git #67: report oai-pmh errors instead of raising an exception for malformed identifiers --- diff --git a/telemeta/interop/oaidatasource.py b/telemeta/interop/oaidatasource.py index f71f86ae..6d589756 100644 --- a/telemeta/interop/oaidatasource.py +++ b/telemeta/interop/oaidatasource.py @@ -56,7 +56,11 @@ class TelemetaOAIDataSource(object): def get_record(self, id): """Return a specific record""" - type, id = id.split(':') + try: + type, id = id.split(':') + except ValueError: + return None + if (type == 'collection'): try: record = MediaCollection.objects.get(id=id) @@ -68,7 +72,7 @@ class TelemetaOAIDataSource(object): except MediaItem.DoesNotExist: return None else: - raise Exception("No such record type: %s" % type) + return None return self.prepare_record(type, record)