merge in brian murray's improvements to the LP bug url handler

This commit is contained in:
Chris Jones 2008-12-15 11:44:16 +00:00
commit ba9907fbe5

View File

@ -398,7 +398,8 @@ text/plain
self.matches['addr_only'] = self._vte.match_add (lboundry + "(www|ftp)[" + hostchars + "]*\.[" + hostchars + ".]+(:[0-9]+)?(" + urlpath + ")?" + rboundry + "/?")
self.matches['email'] = self._vte.match_add (lboundry + "(mailto:)?[a-zA-Z0-9][a-zA-Z0-9.+-]*@[a-zA-Z0-9][a-zA-Z0-9-]*\.[a-zA-Z0-9][a-zA-Z0-9-]+[.a-zA-Z0-9-]*" + rboundry)
self.matches['nntp'] = self._vte.match_add (lboundry + '''news:[-A-Z\^_a-z{|}~!"#$%&'()*+,./0-9;:=?`]+@[-A-Za-z0-9.]+(:[0-9]+)?''' + rboundry)
self.matches['launchpad'] = self._vte.match_add ('\\bLP #[0-9]+\\b')
# if the url looks like a Launchpad changelog closure entry LP: #92953 - make it a url to http://bugs.launchpad.net
self.matches['launchpad'] = self._vte.match_add ('\\bLP:? #?[0-9]+\\b')
def _path_lookup(self, command):
if os.path.isabs (command):
@ -647,7 +648,8 @@ text/plain
if (url[0][0:7] != "mailto:") & (url[1] == self.matches['email']):
address = "mailto:" + url[0]
elif url[1] == self.matches['launchpad']:
address = "https://bugs.launchpad.net/bugs/%s" % url[0][4:]
# the only part of 'launchpad' we need are the actual numbers for the bug
address = "https://bugs.launchpad.net/bugs/%s" % re.sub(r'[^0-9]+', '', url[0])
else:
address = url[0]
self.openurl ( address )
@ -890,7 +892,8 @@ text/plain
# Assume http
address = "http://" + url[0]
elif url[1] == self.matches['launchpad']:
address = "https://bugs.launchpad.net/bugs/%s" % url[0][4:]
# the only part of 'launchpad' we need are the actual numbers for the bug
address = "https://bugs.launchpad.net/bugs/%s" % re.sub(r'[^0-9]+', '', url[0])
else:
address = url[0]
nameopen = _("_Open Link")