fnp
/
wolnelektury.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
2976553
)
Added extraction of wiki_url from DublinCore.
author
Marek Stępniowski
<marek@stepniowski.com>
Thu, 9 Oct 2008 20:35:03 +0000
(22:35 +0200)
committer
Marek Stępniowski
<marek@stepniowski.com>
Thu, 9 Oct 2008 20:35:03 +0000
(22:35 +0200)
lib/librarian/dcparser.py
patch
|
blob
|
history
diff --git
a/lib/librarian/dcparser.py
b/lib/librarian/dcparser.py
index
8542553
..
a410686
100644
(file)
--- 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'))
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')
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'))
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)
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'
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))
for tag, (attribute, converter) in self.mapping.iteritems():
if hasattr(self, attribute):
result[attribute] = unicode(getattr(self, attribute))