Merge lp:~jonathanjgster/ibid/jjg into lp:~ibid-core/ibid/old-trunk-pack-0.92

Proposed by Jonathan Groll
Status: Merged
Approved by: Stefano Rivera
Approved revision: 583
Merged at revision: 593
Proposed branch: lp:~jonathanjgster/ibid/jjg
Merge into: lp:~ibid-core/ibid/old-trunk-pack-0.92
Diff against target: None lines
To merge this branch: bzr merge lp:~jonathanjgster/ibid/jjg
Reviewer Review Type Date Requested Status
Stefano Rivera Approve
Michael Gorven Approve
Jonathan Hitchcock Approve
Review via email: mp+4911@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jonathan Groll (jonathanjgster) wrote :

Delicious logic further fixes: new regexes work with both freenode and atrum's irc daemons; ibid.sources[event.source].type == 'jabber' added; redundant logging of exception message removed since log.exception does so anyway.

Revision history for this message
Jonathan Hitchcock (vhata) :
review: Approve
Revision history for this message
Michael Gorven (mgorven) wrote :

 review approve

review: Approve
Revision history for this message
Stefano Rivera (stefanor) wrote :

Erk, this got forgotten. Will merge now

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ibid/plugins/url.py'
--- ibid/plugins/url.py 2009-03-25 10:35:11 +0000
+++ ibid/plugins/url.py 2009-03-25 15:45:16 +0000
@@ -34,7 +34,8 @@
34class Delicious():34class Delicious():
3535
36 at_re = re.compile('@\S+?\.')36 at_re = re.compile('@\S+?\.')
37 ip_re = re.compile('\.IP$')37 ip_re = re.compile('\.IP$|unaffiliated')
38 con_re = re.compile('!n=|!')
3839
39 def add_post(self,username,password,event,url=None):40 def add_post(self,username,password,event,url=None):
40 "Posts a URL to delicious.com"41 "Posts a URL to delicious.com"
@@ -42,14 +43,14 @@
42 date = datetime.now()43 date = datetime.now()
43 title = self._get_title(url)44 title = self._get_title(url)
4445
45 connection_body = event.sender['connection'].split('!')46 connection_body = self.con_re.split(event.sender['connection'])
46 if len(connection_body) == 1:47 if len(connection_body) == 1:
47 connection_body.append(event.sender['connection'])48 connection_body.append(event.sender['connection'])
4849
49 if self.ip_re.search(connection_body[1]) != None:50 if self.ip_re.search(connection_body[1]) != None:
50 connection_body[1] = ""51 connection_body[1] = ""
5152
52 if event.source == 'jabber':53 if ibid.sources[event.source].type == 'jabber':
53 obfusc_conn = ""54 obfusc_conn = ""
54 obfusc_chan = event.channel.replace('@', '^')55 obfusc_chan = event.channel.replace('@', '^')
55 else:56 else:
@@ -77,7 +78,7 @@
77 log.info(u"Successfully posted url %s to delicious, posted in channel %s by nick %s at time %s", \78 log.info(u"Successfully posted url %s to delicious, posted in channel %s by nick %s at time %s", \
78 url, event.channel, event.sender['nick'], date)79 url, event.channel, event.sender['nick'], date)
79 else:80 else:
80 log.error(u"Error posting url %s to delicious: %s", url, response)81 log.error(u"Error posting url %s to delicious: %s", url, resp)
8182
82 def _get_title(self,url):83 def _get_title(self,url):
83 "Gets the title of a page"84 "Gets the title of a page"
@@ -86,8 +87,8 @@
86 etree = get_html_parse_tree(url, None, headers, 'etree')87 etree = get_html_parse_tree(url, None, headers, 'etree')
87 title = etree.findtext("head/title")88 title = etree.findtext("head/title")
88 return title89 return title
89 except Exception, e:90 except Exception:
90 log.exception(u"Delicious logic - error determining the title for url %s: %s", url, e.message)91 log.exception(u"Delicious logic - error determining the title for url %s", url)
91 return url92 return url
9293
93 def _set_auth(self,username,password):94 def _set_auth(self,username,password):

Subscribers

People subscribed via source and target branches