X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/d4beaf40d156e3aabb4c8f7e6b0d034d9d0d5ad8..17a9ed3b7ef12e0786ddf46bf8a52b1087224762:/librarian/parser.py diff --git a/librarian/parser.py b/librarian/parser.py index 6343d21..b5145a6 100644 --- a/librarian/parser.py +++ b/librarian/parser.py @@ -147,7 +147,7 @@ class WLDocument(object): xpath = self.path_to_xpath(key) node = self.edoc.xpath(xpath)[0] repl = etree.fromstring(u"<%s>%s" %(node.tag, data, node.tag) ) - node.getparent().replace(node, repl); + node.getparent().replace(node, repl) except Exception, e: unmerged.append( repr( (key, xpath, e) ) ) @@ -163,6 +163,21 @@ class WLDocument(object): node.tag = 'span' node.tail = tail + def editors(self): + """Returns a set of all editors for book and its children. + + :returns: set of dcparser.Person objects + """ + if self.book_info is None: + raise NoDublinCore('No Dublin Core in document.') + persons = set(self.book_info.editors + + self.book_info.technical_editors) + for child in self.parts(): + persons.update(child.editors()) + if None in persons: + persons.remove(None) + return persons + # Converters def as_html(self, *args, **kwargs):