mirror of https://github.com/Mikaela/Limnoria.git
Catch some webutils exceptions. Fix a 'literal' usage. Change some 'text'
wraps to 'something'.
This commit is contained in:
parent
a1162bffe1
commit
2911a2c1fe
|
@ -315,7 +315,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp):
|
||||||
defaults to open bugs.
|
defaults to open bugs.
|
||||||
"""
|
"""
|
||||||
self._trackers(irc, args, msg, optlist, project, 'bugs')
|
self._trackers(irc, args, msg, optlist, project, 'bugs')
|
||||||
bugs = wrap(bugs, [getopts(_optDict), additional('text', '')])
|
bugs = wrap(bugs, [getopts(_optDict), additional('something', '')])
|
||||||
|
|
||||||
def rfes(self, irc, msg, args, optlist, project):
|
def rfes(self, irc, msg, args, optlist, project):
|
||||||
"""[--{any,open,closed,deleted,pending}] [<project>]
|
"""[--{any,open,closed,deleted,pending}] [<project>]
|
||||||
|
@ -325,7 +325,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp):
|
||||||
defaults to open rfes.
|
defaults to open rfes.
|
||||||
"""
|
"""
|
||||||
self._trackers(irc, args, msg, optlist, project, 'rfes')
|
self._trackers(irc, args, msg, optlist, project, 'rfes')
|
||||||
rfes = wrap(rfes, [getopts(_optDict), additional('text', '')])
|
rfes = wrap(rfes, [getopts(_optDict), additional('something', '')])
|
||||||
|
|
||||||
def patches(self, irc, msg, args, optlist, project):
|
def patches(self, irc, msg, args, optlist, project):
|
||||||
"""[--{any,open,closed,deleted,pending}] [<project>]
|
"""[--{any,open,closed,deleted,pending}] [<project>]
|
||||||
|
@ -335,7 +335,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp):
|
||||||
defaults to open patches.
|
defaults to open patches.
|
||||||
"""
|
"""
|
||||||
self._trackers(irc, args, msg, optlist, project, 'patches')
|
self._trackers(irc, args, msg, optlist, project, 'patches')
|
||||||
patches = wrap(patches, [getopts(_optDict), additional('text', '')])
|
patches = wrap(patches, [getopts(_optDict), additional('something', '')])
|
||||||
|
|
||||||
_intRe = re.compile(r'(\d+)')
|
_intRe = re.compile(r'(\d+)')
|
||||||
_percentRe = re.compile(r'([\d.]+%)')
|
_percentRe = re.compile(r'([\d.]+%)')
|
||||||
|
@ -400,7 +400,10 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp):
|
||||||
|
|
||||||
_totbugs = re.compile(r'Bugs</a>\s+?\( <b>([^<]+)</b>', re.S | re.I)
|
_totbugs = re.compile(r'Bugs</a>\s+?\( <b>([^<]+)</b>', re.S | re.I)
|
||||||
def _getNumBugs(self, project):
|
def _getNumBugs(self, project):
|
||||||
text = webutils.getUrl('%s%s' % (self._projectURL, project))
|
try:
|
||||||
|
text = webutils.getUrl('%s%s' % (self._projectURL, project))
|
||||||
|
except webutils.WebError, e:
|
||||||
|
raise callbacks.Error, str(e)
|
||||||
m = self._totbugs.search(text)
|
m = self._totbugs.search(text)
|
||||||
if m:
|
if m:
|
||||||
return m.group(1)
|
return m.group(1)
|
||||||
|
@ -410,7 +413,10 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp):
|
||||||
_totrfes = re.compile(r'Feature Requests</a>\s+?\( <b>([^<]+)</b>',
|
_totrfes = re.compile(r'Feature Requests</a>\s+?\( <b>([^<]+)</b>',
|
||||||
re.S | re.I)
|
re.S | re.I)
|
||||||
def _getNumRfes(self, project):
|
def _getNumRfes(self, project):
|
||||||
text = webutils.getUrl('%s%s' % (self._projectURL, project))
|
try:
|
||||||
|
text = webutils.getUrl('%s%s' % (self._projectURL, project))
|
||||||
|
except webutils.WebError, e:
|
||||||
|
raise callbacks.Error, str(e)
|
||||||
m = self._totrfes.search(text)
|
m = self._totrfes.search(text)
|
||||||
if m:
|
if m:
|
||||||
return m.group(1)
|
return m.group(1)
|
||||||
|
@ -427,7 +433,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp):
|
||||||
self._totalbugs(irc, msg, project)
|
self._totalbugs(irc, msg, project)
|
||||||
elif type == 'rfes':
|
elif type == 'rfes':
|
||||||
self._totalrfes(irc, msg, project)
|
self._totalrfes(irc, msg, project)
|
||||||
total = wrap(total, [literal(('bugs', 'rfes')), additional('something')])
|
total = wrap(total, [('literal',('bugs', 'rfes')),additional('something')])
|
||||||
|
|
||||||
def _totalbugs(self, irc, msg, project):
|
def _totalbugs(self, irc, msg, project):
|
||||||
project = project or self.registryValue('defaultProject', msg.args[0])
|
project = project or self.registryValue('defaultProject', msg.args[0])
|
||||||
|
@ -473,7 +479,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp):
|
||||||
s = ', '.join(['\'%s\': %s' % (s, i) for (i, s) in results])
|
s = ', '.join(['\'%s\': %s' % (s, i) for (i, s) in results])
|
||||||
irc.reply(s)
|
irc.reply(s)
|
||||||
fight = wrap(fight, [getopts({'bugs':'','rfes':'','open':'','closed':''}),
|
fight = wrap(fight, [getopts({'bugs':'','rfes':'','open':'','closed':''}),
|
||||||
many('text')])
|
many('something')])
|
||||||
|
|
||||||
def sfSnarfer(self, irc, msg, match):
|
def sfSnarfer(self, irc, msg, match):
|
||||||
r"https?://(?:www\.)?(?:sourceforge|sf)\.net/tracker/" \
|
r"https?://(?:www\.)?(?:sourceforge|sf)\.net/tracker/" \
|
||||||
|
|
Loading…
Reference in New Issue