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