+ def populate_description(self, wldoc=None, infile=None):
+ if wldoc is None:
+ wldoc = self.wldocument(infile)
+ if self.type == 'project':
+ lookup = u'Zadanie'
+ else:
+ lookup = u'Pomysł na lekcję'
+ for header in wldoc.edoc.findall('.//naglowek_rozdzial'):
+ if (header.text or '').strip() == lookup:
+ from lxml import etree
+ self.description = etree.tostring(header.getnext(),
+ method='text', encoding='unicode').strip()
+ self.save()
+ return
+
+ def wldocument(self, infile=None):
+ from librarian import IOFile