From d0475d381f12b2c89c7c514c4f7f7d2ebc421d0a Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Tue, 14 Jun 2016 14:10:15 +0200 Subject: [PATCH] don't assume that there's more than one activity --- librarian/pyhtml.py | 4 ++-- librarian/pypdf.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/librarian/pyhtml.py b/librarian/pyhtml.py index 8615ba2..4f8f98c 100644 --- a/librarian/pyhtml.py +++ b/librarian/pyhtml.py @@ -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 = """%(counter)d.""" % {'counter': counter} else: counter_html = '' @@ -153,7 +153,7 @@ class EduModule(Xmill):
-""" % {'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'))) diff --git a/librarian/pypdf.py b/librarian/pypdf.py index b99f6ad..bb2881f 100644 --- a/librarian/pypdf.py +++ b/librarian/pypdf.py @@ -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 = """%(counter)d.""" % locals() else: counter_tex = '' -- 2.20.1