mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Sync to trunk
This commit is contained in:
commit
6fda0efa6d
@ -642,6 +642,9 @@ class OPF(object):
|
||||
def fset(self, val):
|
||||
matches = self.authors_path(self.metadata)
|
||||
if matches:
|
||||
for key in matches[0].attrib:
|
||||
if key.endswith('file-as'):
|
||||
matches[0].attrib.pop(key)
|
||||
matches[0].set('file-as', unicode(val))
|
||||
|
||||
return property(fget=fget, fset=fset)
|
||||
@ -662,6 +665,9 @@ class OPF(object):
|
||||
def fset(self, val):
|
||||
matches = self.title_path(self.metadata)
|
||||
if matches:
|
||||
for key in matches[0].attrib:
|
||||
if key.endswith('file-as'):
|
||||
matches[0].attrib.pop(key)
|
||||
matches[0].set('file-as', unicode(val))
|
||||
|
||||
return property(fget=fget, fset=fset)
|
||||
@ -842,7 +848,6 @@ class OPF(object):
|
||||
val = getattr(mi, attr, None)
|
||||
if val is not None and val != [] and val != (None, None):
|
||||
setattr(self, attr, val)
|
||||
print self.render()
|
||||
|
||||
|
||||
class OPFCreator(MetaInformation):
|
||||
@ -998,7 +1003,8 @@ class OPFTest(unittest.TestCase):
|
||||
('isbn', 'a'), ('rating', 3), ('series_index', 1),
|
||||
('title_sort', 'ts')]:
|
||||
setattr(self.opf, *test)
|
||||
self.assertEqual(getattr(self.opf, test[0]), test[1])
|
||||
attr, val = test
|
||||
self.assertEqual(getattr(self.opf, attr), val)
|
||||
|
||||
self.opf.render()
|
||||
|
||||
@ -1010,7 +1016,7 @@ class OPFTest(unittest.TestCase):
|
||||
self.testReading(opf=OPF(cStringIO.StringIO(raw), os.getcwd()))
|
||||
|
||||
def testSmartUpdate(self):
|
||||
self.opf.smart_update(self.opf)
|
||||
self.opf.smart_update(MetaInformation(self.opf))
|
||||
self.testReading()
|
||||
|
||||
def testCreator(self):
|
||||
@ -1029,4 +1035,3 @@ def suite():
|
||||
|
||||
def test():
|
||||
unittest.TextTestRunner(verbosity=2).run(suite())
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user