mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Better imports through error handling.
This commit is contained in:
parent
42057e4a23
commit
492d1fb229
3 changed files with 11 additions and 8 deletions
|
@ -13,9 +13,9 @@ class PageImporter(object):
|
|||
|
||||
try:
|
||||
response = urllib2.urlopen(request)
|
||||
except HTTPError, e:
|
||||
except urllib2.HTTPError, e:
|
||||
logging.error('The server couldn\'t fulfill the request. Error: %s' % e.code)
|
||||
except URLError, e:
|
||||
except urllib2.URLError, e:
|
||||
logging.error('Failed to reach server. Reason: %s' % e.reason)
|
||||
else:
|
||||
data = response.read()
|
||||
|
|
|
@ -239,13 +239,14 @@ class Feed(models.Model):
|
|||
date_published = date_published.replace(tzinfo=None)
|
||||
|
||||
entry['published'] = date_published
|
||||
|
||||
protocol_index = entry.get('link', '').find("://")
|
||||
|
||||
entry_link = entry.get('link', '')
|
||||
protocol_index = entry_link.find("://")
|
||||
if protocol_index != -1:
|
||||
entry['link'] = (entry['link'][:protocol_index+3]
|
||||
+ urlquote(entry['link'][protocol_index+3:]))
|
||||
entry['link'] = (entry_link[:protocol_index+3]
|
||||
+ urlquote(entry_link[protocol_index+3:]))
|
||||
else:
|
||||
entry['link'] = urlquote(entry['link'])
|
||||
entry['link'] = urlquote(entry_link)
|
||||
return entry
|
||||
|
||||
class Meta:
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
|
||||
middleLayout = $('.center-pane').layout({
|
||||
center__paneSelector: ".middle-center",
|
||||
center__onresize: "middleLayout.resizeAll",
|
||||
north__paneSelector: ".middle-north",
|
||||
north__size: 208,
|
||||
spacing_open: 10,
|
||||
|
@ -77,6 +78,7 @@
|
|||
|
||||
leftLayout = $('.left-pane').layout({
|
||||
closable: false,
|
||||
center__onresize: "middleLayout.resizeAll",
|
||||
center__paneSelector: ".left-center",
|
||||
south__paneSelector: ".left-south",
|
||||
south__size: 29,
|
||||
|
@ -421,7 +423,7 @@
|
|||
|
||||
$iframe.contents().find(':contains('+title+')').each(function(){
|
||||
if($(this).children().length < 1) {
|
||||
$iframe.scrollTo(this, 1000);
|
||||
$iframe.scrollTo(this, 850, { axis: 'y' });
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue