Merge lp:~stefanor/ibid/urlgrab-702798 into lp:~ibid-core/ibid/old-trunk-1.6

Proposed by Stefano Rivera
Status: Merged
Approved by: Stefano Rivera
Approved revision: 911
Merged at revision: 1006
Proposed branch: lp:~stefanor/ibid/urlgrab-702798
Merge into: lp:~ibid-core/ibid/old-trunk-1.6
Diff against target: 40 lines (+3/-9)
1 file modified
ibid/plugins/urlgrab.py (+3/-9)
To merge this branch: bzr merge lp:~stefanor/ibid/urlgrab-702798
Reviewer Review Type Date Requested Status
marcog (community) Approve
Jonathan Hitchcock Approve
Max Rabkin Approve
Review via email: mp+47148@code.launchpad.net

Commit message

HTTPErrors should result in using url as title, not abandoning the grab

To post a comment you must log in.
lp:~stefanor/ibid/urlgrab-702798 updated
910. By Stefano Rivera

Update copyright

Revision history for this message
Max Rabkin (max-rabkin) :
review: Approve
lp:~stefanor/ibid/urlgrab-702798 updated
911. By Stefano Rivera

Remove an unecessary datetime.utcnow() while we are here

Revision history for this message
Jonathan Hitchcock (vhata) :
review: Approve
Revision history for this message
marcog (marco-gallotta) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ibid/plugins/urlgrab.py'
2--- ibid/plugins/urlgrab.py 2010-03-01 15:13:45 +0000
3+++ ibid/plugins/urlgrab.py 2011-01-26 20:34:08 +0000
4@@ -1,4 +1,4 @@
5-# Copyright (c) 2009-2010, Michael Gorven, Stefano Rivera, Jonathan Groll
6+# Copyright (c) 2009-2011, Michael Gorven, Stefano Rivera, Jonathan Groll
7 # Released under terms of the MIT/X/Expat Licence. See COPYING for details.
8
9 from datetime import datetime
10@@ -84,11 +84,7 @@
11 def _post_url(self, event, url=None):
12 "Posts a URL to delicious.com"
13
14- date = datetime.utcnow()
15- try:
16- title = self._get_title(url)
17- except HTTPError:
18- return
19+ title = self._get_title(url)
20
21 con_re = re.compile(r'!n=|!')
22 connection_body = con_re.split(event.sender['connection'])
23@@ -115,7 +111,7 @@
24 'description' : title.encode('utf-8'),
25 'tags' : tags.encode('utf-8'),
26 'replace' : 'yes',
27- 'dt' : date.strftime('%Y-%m-%dT%H:%M:%SZ'),
28+ 'dt' : event.time.strftime('%Y-%m-%dT%H:%M:%SZ'),
29 'extended' : event.message['raw'].encode('utf-8'),
30 }
31
32@@ -159,8 +155,6 @@
33 etree = get_html_parse_tree(url, None, headers, 'etree')
34 title = etree.findtext('head/title')
35 return title or url
36- except HTTPError, e:
37- raise
38 except Exception, e:
39 log.debug(u"Error determining title for %s: %s", url, unicode(e))
40 return url

Subscribers

People subscribed via source and target branches