Put file-as back into OPF title_sort.get as a fall back

This commit is contained in:
Charles Haley 2011-02-01 17:28:55 +00:00
parent f62cb543a5
commit 9acd6d6189

View File

@ -780,15 +780,24 @@ class OPF(object): # {{{
def title_sort(self): def title_sort(self):
def fget(self): def fget(self):
#first try the title_sort meta tag
matches = self.root.xpath('//*[name() = "meta" and starts-with(@name,' matches = self.root.xpath('//*[name() = "meta" and starts-with(@name,'
'"calibre:title_sort") and @content]') '"calibre:title_sort") and @content]')
if matches: if matches:
for elem in matches: for elem in matches:
return self.get_text(elem) return self.get_text(elem)
# fallback to file-as
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
return None return None
def fset(self, val): def fset(self, val):
print 'here'
matches = self.root.xpath('//*[name() = "meta" and starts-with(@name,' matches = self.root.xpath('//*[name() = "meta" and starts-with(@name,'
'"calibre:title_sort") and @content]') '"calibre:title_sort") and @content]')
if matches: if matches: