From 87c18bbe4e7fafbc89442c15e49d4099182c7567 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20St=C4=99pniowski?= Date: Thu, 9 Oct 2008 22:35:03 +0200 Subject: [PATCH 1/1] Added extraction of wiki_url from DublinCore. --- lib/librarian/dcparser.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/librarian/dcparser.py b/lib/librarian/dcparser.py index 8542553cf..a4106863d 100644 --- a/lib/librarian/dcparser.py +++ b/lib/librarian/dcparser.py @@ -134,6 +134,8 @@ class BookInfo(object): raise ParseError(e) description = tree.find('//' + book_info.RDF('Description')) + book_info.wiki_url = description.get(cls.RDF('about'), None) + if description is None: raise ParseError('no Description tag found in document') @@ -157,6 +159,9 @@ class BookInfo(object): root = etree.Element(self.RDF('RDF')) description = etree.SubElement(root, self.RDF('Description')) + if self.wiki_url: + description.set(self.RDF('about'), self.wiki_url) + for tag, (attribute, converter) in self.mapping.iteritems(): if hasattr(self, attribute): e = etree.Element(tag) @@ -169,7 +174,7 @@ class BookInfo(object): etree._namespace_map[str(self.RDF)] = 'rdf' etree._namespace_map[str(self.DC)] = 'dc' - result = {} + result = {'about': self.wiki_url} for tag, (attribute, converter) in self.mapping.iteritems(): if hasattr(self, attribute): result[attribute] = unicode(getattr(self, attribute)) -- 2.20.1