mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-23 02:24:12 +01:00
Changed the name of WebException to WebError.
This commit is contained in:
parent
b6faf3602e
commit
7b9c0ccd86
@ -154,7 +154,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable):
|
|||||||
else:
|
else:
|
||||||
return 'http://sourceforge.net%s%s' % (utils.htmlToText(
|
return 'http://sourceforge.net%s%s' % (utils.htmlToText(
|
||||||
m.group(1)), self._hrefOpts)
|
m.group(1)), self._hrefOpts)
|
||||||
except webutils.WebException, e:
|
except webutils.WebError, e:
|
||||||
raise callbacks.Error, str(e)
|
raise callbacks.Error, str(e)
|
||||||
|
|
||||||
def _getTrackerList(self, url):
|
def _getTrackerList(self, url):
|
||||||
@ -168,7 +168,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable):
|
|||||||
return '%s' % utils.commaAndify(resp)
|
return '%s' % utils.commaAndify(resp)
|
||||||
raise callbacks.Error, 'No Trackers were found. (%s)' %\
|
raise callbacks.Error, 'No Trackers were found. (%s)' %\
|
||||||
conf.replyPossibleBug
|
conf.replyPossibleBug
|
||||||
except webutils.WebException, e:
|
except webutils.WebError, e:
|
||||||
raise callbacks.Error, e.msg()
|
raise callbacks.Error, e.msg()
|
||||||
|
|
||||||
def _getTrackerInfo(self, irc, msg, url, num):
|
def _getTrackerInfo(self, irc, msg, url, num):
|
||||||
@ -181,7 +181,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable):
|
|||||||
return
|
return
|
||||||
irc.error(msg, 'No Trackers were found. (%s)' %
|
irc.error(msg, 'No Trackers were found. (%s)' %
|
||||||
conf.replyPossibleBug)
|
conf.replyPossibleBug)
|
||||||
except webutils.WebException, e:
|
except webutils.WebError, e:
|
||||||
irc.error(msg, e.msg())
|
irc.error(msg, e.msg())
|
||||||
|
|
||||||
_bugLink = re.compile(r'"([^"]+)">Bugs')
|
_bugLink = re.compile(r'"([^"]+)">Bugs')
|
||||||
@ -317,7 +317,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable):
|
|||||||
resp.append('%s: %s' % self._bold(m.groups()))
|
resp.append('%s: %s' % self._bold(m.groups()))
|
||||||
irc.reply(msg, '%s #%s: %s' % (ircutils.bold(linktype),
|
irc.reply(msg, '%s #%s: %s' % (ircutils.bold(linktype),
|
||||||
ircutils.bold(num), '; '.join(resp)), prefixName = False)
|
ircutils.bold(num), '; '.join(resp)), prefixName = False)
|
||||||
except webutils.WebException, e:
|
except webutils.WebError, e:
|
||||||
self.log.warning(str(e))
|
self.log.warning(str(e))
|
||||||
sfSnarfer = privmsgs.urlSnarfer(sfSnarfer)
|
sfSnarfer = privmsgs.urlSnarfer(sfSnarfer)
|
||||||
|
|
||||||
|
@ -36,22 +36,23 @@ import fix
|
|||||||
import socket
|
import socket
|
||||||
import urllib2
|
import urllib2
|
||||||
|
|
||||||
class WebException(Exception):
|
class WebError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def getUrlFd(url):
|
def getUrlFd(url):
|
||||||
|
"""Gets a file-like object for a url."""
|
||||||
try:
|
try:
|
||||||
fd = urllib2.urlopen(url)
|
fd = urllib2.urlopen(url)
|
||||||
return fd
|
return fd
|
||||||
except socket.error, e:
|
except socket.error, e:
|
||||||
if e.args[0] == 111:
|
if e.args[0] == 111:
|
||||||
raise WebException, 'Connection refused.'
|
raise WebError, 'Connection refused.'
|
||||||
elif e.args[0] in (110, 10060):
|
elif e.args[0] in (110, 10060):
|
||||||
raise WebException, 'Connection timed out.'
|
raise WebError, 'Connection timed out.'
|
||||||
else:
|
else:
|
||||||
raise WebException, str(e)
|
raise WebError, str(e)
|
||||||
except (urllib2.HTTPError, urllib2.URLError), e:
|
except (urllib2.HTTPError, urllib2.URLError), e:
|
||||||
raise WebException, str(e)
|
raise WebError, str(e)
|
||||||
|
|
||||||
def getUrl(url, size=None):
|
def getUrl(url, size=None):
|
||||||
"""Gets a page. Returns a string that is the page gotten."""
|
"""Gets a page. Returns a string that is the page gotten."""
|
||||||
|
Loading…
Reference in New Issue
Block a user