fnp
/
librarian.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Booktoteka packager and some cover refactoring
[librarian.git]
/
librarian
/
dcparser.py
diff --git
a/librarian/dcparser.py
b/librarian/dcparser.py
index
49a33d4
..
9faffe8
100644
(file)
--- a/
librarian/dcparser.py
+++ b/
librarian/dcparser.py
@@
-44,6
+44,11
@@
class Person(object):
def __eq__(self, right):
return self.last_name == right.last_name and self.first_names == right.first_names
def __eq__(self, right):
return self.last_name == right.last_name and self.first_names == right.first_names
+ def __cmp__(self, other):
+ return cmp((self.last_name, self.first_names), (other.last_name, other.first_names))
+
+ def __hash__(self):
+ return hash((self.last_name, self.first_names))
def __unicode__(self):
if len(self.first_names) > 0:
def __unicode__(self):
if len(self.first_names) > 0:
@@
-263,7
+268,8
@@
class BookInfo(object):
if len(v) == 0: continue
for x in v:
e = etree.Element(field.uri)
if len(v) == 0: continue
for x in v:
e = etree.Element(field.uri)
- e.text = unicode(x)
+ if x is not None:
+ e.text = unicode(x)
description.append(e)
else:
e = etree.Element(field.uri)
description.append(e)
else:
e = etree.Element(field.uri)
@@
-283,7
+289,7
@@
class BookInfo(object):
if v is not None:
if field.multiple:
if len(v) == 0: continue
if v is not None:
if field.multiple:
if len(v) == 0: continue
- v = [ unicode(x) for x in v if
v
is not None ]
+ v = [ unicode(x) for x in v if
x
is not None ]
else:
v = unicode(v)
else:
v = unicode(v)
@@
-299,7
+305,7
@@
class BookInfo(object):
if v is not None:
if field.multiple:
if len(v) == 0: continue
if v is not None:
if field.multiple:
if len(v) == 0: continue
- v = [ unicode(x) for x in v if
v
is not None ]
+ v = [ unicode(x) for x in v if
x
is not None ]
else:
v = unicode(v)
result[field.name] = v
else:
v = unicode(v)
result[field.name] = v