Fix the auctionSnarfer regexp to be more generic and stop logging bad snarfs

as an exception.  Warning is good enough.
This commit is contained in:
James Vega 2004-08-29 02:13:00 +00:00
parent 6bb8104efb
commit 78b9d0b47d

View File

@ -60,7 +60,7 @@ def configure(advanced):
if yn('Do you want the Ebay snarfer enabled by default?'): if yn('Do you want the Ebay snarfer enabled by default?'):
conf.supybot.plugins.Ebay.auctionSnarfer.setValue(True) conf.supybot.plugins.Ebay.auctionSnarfer.setValue(True)
class EbayError(callbacks.Error): class EbayError(Exception):
pass pass
conf.registerPlugin('Ebay') conf.registerPlugin('Ebay')
@ -115,7 +115,7 @@ class Ebay(callbacks.PrivmsgCommandAndRegexp):
irc.reply(str(e)) irc.reply(str(e))
def ebaySnarfer(self, irc, msg, match): def ebaySnarfer(self, irc, msg, match):
r"http://cgi\.ebay\.(?:com(?:.au)?|ca|co.uk)/(?:.*?/)?(?:ws/)?" \ r"http://cgi\.ebay\.(?:[a-z]+.?)+/(?:.*?/)?(?:ws/)?" \
r"eBayISAPI\.dll\?ViewItem(?:&item=\d+|&category=\d+)+" r"eBayISAPI\.dll\?ViewItem(?:&item=\d+|&category=\d+)+"
if not self.registryValue('auctionSnarfer', msg.args[0]): if not self.registryValue('auctionSnarfer', msg.args[0]):
return return
@ -123,7 +123,7 @@ class Ebay(callbacks.PrivmsgCommandAndRegexp):
try: try:
irc.reply(self._getResponse(url), prefixName=False) irc.reply(self._getResponse(url), prefixName=False)
except EbayError, e: except EbayError, e:
self.log.exception('ebaySnarfer exception at %s:', url) self.log.warning('ebaySnarfer exception at %s: %s', url, str(e))
ebaySnarfer = privmsgs.urlSnarfer(ebaySnarfer) ebaySnarfer = privmsgs.urlSnarfer(ebaySnarfer)
def _getResponse(self, url): def _getResponse(self, url):