mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
Dont die when print_version raises an exception
This commit is contained in:
parent
21b256018d
commit
449bc10862
@ -214,10 +214,15 @@ class DefaultProfile(object):
|
|||||||
content = self.process_html_description(content, strip_links=False)
|
content = self.process_html_description(content, strip_links=False)
|
||||||
else:
|
else:
|
||||||
content = ''
|
content = ''
|
||||||
|
purl = url
|
||||||
|
try:
|
||||||
|
purl = self.print_version(url)
|
||||||
|
except Exception, err:
|
||||||
|
self.logger.debug('Skipping %s as could not find URL for print version. Error:\n%s'%(url, err))
|
||||||
|
continue
|
||||||
d = {
|
d = {
|
||||||
'title' : item.find('title').string,
|
'title' : item.find('title').string,
|
||||||
'url' : self.print_version(url),
|
'url' : purl,
|
||||||
'timestamp': self.strptime(pubdate) if self.use_pubdate else time.time(),
|
'timestamp': self.strptime(pubdate) if self.use_pubdate else time.time(),
|
||||||
'date' : pubdate if self.use_pubdate else time.ctime(),
|
'date' : pubdate if self.use_pubdate else time.ctime(),
|
||||||
'content' : content,
|
'content' : content,
|
||||||
@ -412,4 +417,12 @@ def cutoff(src, pos, fuzz=50):
|
|||||||
if npos < 0:
|
if npos < 0:
|
||||||
npos = pos
|
npos = pos
|
||||||
return src[:npos+1]
|
return src[:npos+1]
|
||||||
|
|
||||||
|
def create_class(src):
|
||||||
|
environment = {'FullContentProfile':FullContentProfile, 'DefaultProfile':DefaultProfile}
|
||||||
|
exec src in environment
|
||||||
|
for item in environment.values():
|
||||||
|
if hasattr(item, 'build_index'):
|
||||||
|
if item.__name__ not in ['DefaultProfile', 'FullContentProfile']:
|
||||||
|
return item
|
||||||
|
|
@ -15,7 +15,7 @@ class WallStreetJournal(DefaultProfile):
|
|||||||
title = 'Wall Street Journal'
|
title = 'Wall Street Journal'
|
||||||
max_recursions = 2
|
max_recursions = 2
|
||||||
needs_subscription = True
|
needs_subscription = True
|
||||||
max_articles_per_feed = 50
|
max_articles_per_feed = 10
|
||||||
timefmt = ' [%a, %b %d, %Y]'
|
timefmt = ' [%a, %b %d, %Y]'
|
||||||
html_description = True
|
html_description = True
|
||||||
no_stylesheets = False
|
no_stylesheets = False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user