don't assume that there's more than one activity
authorJan Szejko <jan.szejko@gmail.com>
Tue, 14 Jun 2016 12:10:15 +0000 (14:10 +0200)
committerJan Szejko <jan.szejko@gmail.com>
Tue, 14 Jun 2016 12:10:15 +0000 (14:10 +0200)
librarian/pyhtml.py
librarian/pypdf.py

index 8615ba2..4f8f98c 100644 (file)
@@ -131,7 +131,7 @@ class EduModule(Xmill):
 
         counter = self.activity_counter
 
-        if element.getnext().tag == 'aktywnosc' or self.activity_last.getnext() == element:
+        if element.getnext().tag == 'aktywnosc' or (self.activity_last and self.activity_last.getnext() == element):
             counter_html = """<span class="act_counter">%(counter)d.</span>""" % {'counter': counter}
         else:
             counter_html = ''
@@ -153,7 +153,7 @@ class EduModule(Xmill):
   </aside>
   <div class="clearboth"></div>
 </div>
-""" % {'wskazowki': wskazowki, 'czas': czas, 'forma': forms, 'pomoce': pomoce})
+""" % {'wskazowki': wskazowki, 'czas': czas, 'forma': forma, 'pomoce': pomoce})
 
     handle_opis = ifoption(sub_gen=True)(tag('div', 'description'))
     handle_wskazowki = ifoption(sub_gen=True)(tag('div', ('hints', 'teacher')))
index b99f6ad..bb2881f 100644 (file)
@@ -261,7 +261,7 @@ class EduModule(Xmill):
 
         counter = self.activity_counter
 
-        if element.getnext().tag == 'aktywnosc' or self.activity_last.getnext() == element:
+        if element.getnext().tag == 'aktywnosc' or (self.activity_last and self.activity_last.getnext() == element):
             counter_tex = """<cmd name="activitycounter"><parm>%(counter)d.</parm></cmd>""" % locals()
         else:
             counter_tex = ''