X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/39b34a512dc030509c4c0161a8d9e336b8c82d24..8ac6e02d37081946e15e888d391b13bede1843d7:/apps/catalogue/models/book.py diff --git a/apps/catalogue/models/book.py b/apps/catalogue/models/book.py index b5a3bf34..f58fe108 100755 --- a/apps/catalogue/models/book.py +++ b/apps/catalogue/models/book.py @@ -430,6 +430,7 @@ class Book(models.Model): import os.path from django.conf import settings from fnpdjango.utils.text.slughifi import slughifi + from librarian import ParseError def _register_function(f): """ Register extension function with lxml """ @@ -471,7 +472,7 @@ class Book(models.Model): break else: # print 'BRAK PRZEBIEGU' - raise ValueError('Brak przebiegu') + raise ParseError('Brak przebiegu') i1.getroot().attrib['redslug'] = self.slug i1.getroot().attrib['wlslug'] = self.slug # THIS! @@ -479,6 +480,6 @@ class Book(models.Model): w1t = i1.xslt(t) for h in w1t.findall('//aktywnosc/opis'): if not re.match(r'\d\.\s', h[0].text): - raise AssertionError('Niepoprawny nagłówek (aktywnosc/opis): %s' % repr(h[0].text)) + raise ParseError('Niepoprawny nagłówek (aktywnosc/opis): %s' % repr(h[0].text)) h[0].text = h[0].text[3:] return etree.tostring(w1t, encoding='utf-8')