mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Sync to trunk
This commit is contained in:
commit
974d393d6c
@ -666,6 +666,26 @@ class OPF(object):
|
|||||||
|
|
||||||
return property(fget=fget, fset=fset)
|
return property(fget=fget, fset=fset)
|
||||||
|
|
||||||
|
@apply
|
||||||
|
def title_sort():
|
||||||
|
|
||||||
|
def fget(self):
|
||||||
|
matches = self.title_path(self.metadata)
|
||||||
|
if matches:
|
||||||
|
for match in matches:
|
||||||
|
ans = match.get('{%s}file-as'%self.NAMESPACES['opf'], None)
|
||||||
|
if not ans:
|
||||||
|
ans = match.get('file-as', None)
|
||||||
|
if ans:
|
||||||
|
return ans
|
||||||
|
|
||||||
|
def fset(self, val):
|
||||||
|
matches = self.title_path(self.metadata)
|
||||||
|
if matches:
|
||||||
|
matches[0].set('file-as', unicode(val))
|
||||||
|
|
||||||
|
return property(fget=fget, fset=fset)
|
||||||
|
|
||||||
@apply
|
@apply
|
||||||
def tags():
|
def tags():
|
||||||
|
|
||||||
@ -993,6 +1013,17 @@ class OPFTest(unittest.TestCase):
|
|||||||
self.opf.smart_update(self.opf)
|
self.opf.smart_update(self.opf)
|
||||||
self.testReading()
|
self.testReading()
|
||||||
|
|
||||||
|
def testCreator(self):
|
||||||
|
opf = OPFCreator(os.getcwd(), self.opf)
|
||||||
|
buf = cStringIO.StringIO()
|
||||||
|
opf.render(buf)
|
||||||
|
raw = buf.getvalue()
|
||||||
|
self.testReading(opf=OPF(cStringIO.StringIO(raw), os.getcwd()))
|
||||||
|
|
||||||
|
def testSmartUpdate(self):
|
||||||
|
self.opf.smart_update(self.opf)
|
||||||
|
self.testReading()
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
return unittest.TestLoader().loadTestsFromTestCase(OPFTest)
|
return unittest.TestLoader().loadTestsFromTestCase(OPFTest)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user