mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1214 (Feeds2lrf crash when downloading http://rss.gazeta.pl/pub/rss/gazetawyborcza.xml)
This commit is contained in:
parent
0f6cbc5109
commit
102aa48708
@ -573,7 +573,10 @@ class Processor(Parser):
|
|||||||
style.tail = '\n'
|
style.tail = '\n'
|
||||||
path = os.path.join(os.path.dirname(self.save_path()), *(style.get('href').split('/')))
|
path = os.path.join(os.path.dirname(self.save_path()), *(style.get('href').split('/')))
|
||||||
self.resource_map[path] = style.get('href')
|
self.resource_map[path] = style.get('href')
|
||||||
open(path, 'wb').write(getattr(sheet, 'cssText', sheet).encode('utf-8'))
|
raw = getattr(sheet, 'cssText', sheet)
|
||||||
|
if isinstance(raw, unicode):
|
||||||
|
raw = raw.encode('utf-8')
|
||||||
|
open(path, 'wb').write(raw)
|
||||||
return Parser.save(self)
|
return Parser.save(self)
|
||||||
|
|
||||||
def populate_toc(self, toc):
|
def populate_toc(self, toc):
|
||||||
|
@ -72,6 +72,8 @@ class DBTest(unittest.TestCase):
|
|||||||
self.assertEqual(getattr(self.db, x)(2), val)
|
self.assertEqual(getattr(self.db, x)(2), val)
|
||||||
|
|
||||||
self.db.set_authors(3, ['new auth'])
|
self.db.set_authors(3, ['new auth'])
|
||||||
|
self.db.refresh_ids([3])
|
||||||
|
self.assertEqual('new auth', self.db.authors(2))
|
||||||
self.assertEqual(self.db.format(3, 'txt', index_is_id=True), 'test')
|
self.assertEqual(self.db.format(3, 'txt', index_is_id=True), 'test')
|
||||||
|
|
||||||
|
|
||||||
|
@ -541,8 +541,10 @@ class BasicNewsRecipe(object, LoggingInterface):
|
|||||||
npos = max(si, gi)
|
npos = max(si, gi)
|
||||||
if npos < 0:
|
if npos < 0:
|
||||||
npos = pos
|
npos = pos
|
||||||
|
ans = src[:npos+1]
|
||||||
return src[:npos+1]+u'\u2026'
|
if isinstance(ans, unicode):
|
||||||
|
return
|
||||||
|
return ans+u'\u2026' if isinstance(ans, unicode) else ans + '...'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user