From 54cbe1753f95bb2dd3441ba5966c32ea63ffcbad Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Thu, 23 Jun 2016 12:02:09 +0200 Subject: [PATCH] don't assume that aktywnosc/opis is non-empty --- apps/catalogue/models/book.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/catalogue/models/book.py b/apps/catalogue/models/book.py index 626dd9cc..09164a39 100755 --- a/apps/catalogue/models/book.py +++ b/apps/catalogue/models/book.py @@ -479,6 +479,8 @@ class Book(models.Model): # print '.', w1t = i1.xslt(t) for h in w1t.findall('//aktywnosc/opis'): + if len(h) == 0: + raise ParseError('Pusty element aktywnosc/opis') # FIXME assumption that every lesson has at most 9 parts if not h[0].text or not re.match(r'\d\.\s', h[0].text): raise ParseError('Niepoprawny nagłówek (aktywnosc/opis): %s' % repr(h[0].text)) -- 2.20.1