X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/db06ae78aac8e159e731524fc8588e7ad6945e20..b103d6f69bec99cbcc3eb2f0509d950f0a1c0642:/apps/catalogue/models/document.py diff --git a/apps/catalogue/models/document.py b/apps/catalogue/models/document.py index 70f50f25..d58a4d1f 100755 --- a/apps/catalogue/models/document.py +++ b/apps/catalogue/models/document.py @@ -7,6 +7,7 @@ from __future__ import unicode_literals from datetime import date from django.conf import settings +from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned from django.db import models from django.template.loader import render_to_string from django.utils.translation import ugettext_lazy as _ @@ -53,7 +54,7 @@ class Document(Ref): if header is None: header = etree.fromstring(data).find('.//{http://nowoczesnapolska.org.pl/sst#}header') metadata['title'] = getattr(header, 'text', ' ') or ' ' - #print 'meta', d['title'] + # print 'meta', d['title'] m = t.find('metadata') if m is None: @@ -86,7 +87,7 @@ class Document(Ref): def get_plan(self): try: plan = self.plan_set.get(stage=self.stage) - except: + except (ObjectDoesNotExist, MultipleObjectsReturned): return None return plan