Handle unicode metadata in the book list.

This commit is contained in:
Kovid Goyal 2007-09-15 15:08:12 +00:00
parent b3d74f9a89
commit e50f30392d

View File

@ -49,7 +49,9 @@ class book_metadata_field(object):
def __set__(self, obj, val): def __set__(self, obj, val):
""" Set the attribute """ """ Set the attribute """
val = self.setter(val) if self.setter else val val = self.setter(val) if self.setter else val
obj.elem.setAttribute(self.attr, str(val)) if not isinstance(val, unicode):
val = unicode(val, 'utf8', 'replace')
obj.elem.setAttribute(self.attr, val)
class Book(object): class Book(object):
""" Provides a view onto the XML element that represents a book """ """ Provides a view onto the XML element that represents a book """