fix self.XPATH() calls to OPF.XPath() instead since 3.14 made functools.partial a descriptor and thus injected self as the first argument
This commit is contained in:
@@ -697,7 +697,7 @@ class OPF(object): # {{{
|
|||||||
def find_toc(self):
|
def find_toc(self):
|
||||||
self.toc = None
|
self.toc = None
|
||||||
try:
|
try:
|
||||||
spine = self.XPath('descendant::*[re:match(name(), "spine", '
|
spine = OPF.XPath('descendant::*[re:match(name(), "spine", '
|
||||||
'"i")]')(self.root)
|
'"i")]')(self.root)
|
||||||
toc = None
|
toc = None
|
||||||
if spine:
|
if spine:
|
||||||
@@ -801,7 +801,7 @@ class OPF(object): # {{{
|
|||||||
|
|
||||||
def replace_spine_items_by_idref(self, idref, new_idrefs):
|
def replace_spine_items_by_idref(self, idref, new_idrefs):
|
||||||
items = list(map(self.create_spine_item, new_idrefs))
|
items = list(map(self.create_spine_item, new_idrefs))
|
||||||
spine = self.XPath('/opf:package/*[re:match(name(), "spine", '
|
spine = OPF.XPath('/opf:package/*[re:match(name(), "spine", '
|
||||||
'"i")]')(self.root)[0]
|
'"i")]')(self.root)[0]
|
||||||
old = [i for i in self.iterspine() if i.get('idref', None) == idref]
|
old = [i for i in self.iterspine() if i.get('idref', None) == idref]
|
||||||
for x in old:
|
for x in old:
|
||||||
@@ -1005,7 +1005,7 @@ class OPF(object): # {{{
|
|||||||
|
|
||||||
def get_identifiers(self):
|
def get_identifiers(self):
|
||||||
identifiers = {}
|
identifiers = {}
|
||||||
for x in self.XPath(
|
for x in OPF.XPath(
|
||||||
'descendant::*[local-name() = "identifier" and text()]')(
|
'descendant::*[local-name() = "identifier" and text()]')(
|
||||||
self.metadata):
|
self.metadata):
|
||||||
found_scheme = False
|
found_scheme = False
|
||||||
@@ -1039,7 +1039,7 @@ class OPF(object): # {{{
|
|||||||
uuid_id = self.root.attrib[attr]
|
uuid_id = self.root.attrib[attr]
|
||||||
break
|
break
|
||||||
|
|
||||||
for x in self.XPath(
|
for x in OPF.XPath(
|
||||||
'descendant::*[local-name() = "identifier"]')(
|
'descendant::*[local-name() = "identifier"]')(
|
||||||
self.metadata):
|
self.metadata):
|
||||||
xid = x.get('id', None)
|
xid = x.get('id', None)
|
||||||
@@ -1175,7 +1175,7 @@ class OPF(object): # {{{
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def page_progression_direction(self):
|
def page_progression_direction(self):
|
||||||
spine = self.XPath('descendant::*[re:match(name(), "spine", '
|
spine = OPF.XPath('descendant::*[re:match(name(), "spine", '
|
||||||
'"i")][1]')(self.root)
|
'"i")][1]')(self.root)
|
||||||
if spine:
|
if spine:
|
||||||
for k, v in spine[0].attrib.items():
|
for k, v in spine[0].attrib.items():
|
||||||
@@ -1185,7 +1185,7 @@ class OPF(object): # {{{
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def primary_writing_mode(self):
|
def primary_writing_mode(self):
|
||||||
for m in self.XPath('//*[local-name()="meta" and @name="primary-'
|
for m in OPF.XPath('//*[local-name()="meta" and @name="primary-'
|
||||||
'writing-mode" and @content]')(self.root):
|
'writing-mode" and @content]')(self.root):
|
||||||
return m.get('content')
|
return m.get('content')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user