From 06800f9fc75b14c97e32758d489b5c77da66dff7 Mon Sep 17 00:00:00 2001 From: James Vega Date: Sat, 7 May 2005 03:55:14 +0000 Subject: [PATCH] Correctly catch the HTMLParseError --- plugins/Web/plugin.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/Web/plugin.py b/plugins/Web/plugin.py index fa375f82d..55efb58d8 100644 --- a/plugins/Web/plugin.py +++ b/plugins/Web/plugin.py @@ -28,8 +28,7 @@ ### import re - -from HTMLParser import HTMLParser +import HTMLParser import supybot.conf as conf import supybot.utils as utils @@ -38,11 +37,11 @@ import supybot.plugins as plugins import supybot.ircutils as ircutils import supybot.callbacks as callbacks -class Title(HTMLParser): +class Title(HTMLParser.HTMLParser): def __init__(self, *args, **kwargs): self.inTitle = False self.title = None - HTMLParser.__init__(self, *args, **kwargs) + HTMLParser.HTMLParser.__init__(self, *args, **kwargs) def handle_starttag(self, tag, attrs): if tag == 'title': @@ -88,7 +87,7 @@ class Web(callbacks.PluginRegexp): parser = Title() try: parser.feed(text) - except HTMLParserError: + except HTMLParser.HTMLParseError: self.log.debug('Unable to parse %u', url) return if parser.title is not None: @@ -164,9 +163,10 @@ class Web(callbacks.PluginRegexp): parser = Title() try: parser.feed(text) - except HTMLParserError: + except HTMLParser.HTMLParseError: irc.reply(format('That URL appears to have no HTML title within ' 'the first %i bytes.', size)) + return if parser.title is not None: irc.reply(utils.web.htmlToText(parser.title.strip())) else: