fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
don't assume that aktywnosc/opis is non-empty
[redakcja.git]
/
apps
/
catalogue
/
models
/
book.py
diff --git
a/apps/catalogue/models/book.py
b/apps/catalogue/models/book.py
index
b0862f0
..
09164a3
100755
(executable)
--- a/
apps/catalogue/models/book.py
+++ b/
apps/catalogue/models/book.py
@@
-479,7
+479,10
@@
class Book(models.Model):
# print '.',
w1t = i1.xslt(t)
for h in w1t.findall('//aktywnosc/opis'):
# print '.',
w1t = i1.xslt(t)
for h in w1t.findall('//aktywnosc/opis'):
- if not re.match(r'\d\.\s', h[0].text):
+ 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))
h[0].text = h[0].text[3:]
return etree.tostring(w1t, encoding='utf-8')
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')