From 7bb3b1ec600567f6d8a83cbb5d2efefdd66e3aa6 Mon Sep 17 00:00:00 2001 From: James Vega Date: Mon, 22 Oct 2007 17:48:49 +0000 Subject: [PATCH] Merge the changes from the python25compat branch into the trunk --- ChangeLog | 57 ++++++++++++++++++++++++++++++++++++++++++ RELNOTES | 6 +++++ plugins/Misc/plugin.py | 1 + plugins/RSS/config.py | 10 ++++---- plugins/RSS/plugin.py | 4 +-- scripts/supybot | 2 +- setup.py | 2 +- src/conf.py | 2 +- src/ircmsgs.py | 4 ++- src/log.py | 11 ++++---- 10 files changed, 82 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 31067324e..615cc6acf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,60 @@ +2007-10-22 James Vega + + * Version 0.83.3! + + * Added the BadWords plugin from supybot-plugins and updated the + plugin to allow kicking of people who use defined BadWords. + + * Added support for different log levels on stdout vs the log file. + + * Fixed a bug where the bot always reacted to invalid command floods + even if supybot.abuse.flood.command.invalid indicated not to. + (Closes: #1716878) + + * Fixed a bug where the RSS plugin would lower-case URLs, thus making + them impossible to retrieve. (Closes: #1666786) + + * Fixed ircmsgs.prettyPrint to handle unrecognized commands. + (Closes: #1630963) + + * Fixed a bug in the Services plugin where the bot would continuously + send Ghost commands. + + * Fixed Google.calc to handle a change in Google's HTML. + + * Fixed a bug where Plugin.list was listing functions which weren't + valid commands. + + * Fixed RSS's handling of encodings to eliminate some ascii conversion + errors. + + * Updated the rssparser using plugins with the renamed and newer + feedparser 4.1 in order to properly handle Bugzilla RSS feeds. + + * Updated PLUGIN_TUTORIAL to specify that the user needs to import + Python's random module. + + * Updated the Web plugin so it uses HTMLParser over sgmllib's parser + since sgmllib's enters an infinite loop on invalid input. + + * Updated getHelp() so callers can pass in the help string. This is + used in the Factoids plugin to dynamically generate a help string + based on a config value. + + * Updated questions.py so bolding is handled better. User input, + default values, and defined choices are no longer bolded. + + * Updated String.len to use wrap(). This greatly simplifies the + command and introduces better argument handling. + + * Updated a few uses of sre to use re if the bot is running under + Python 2.5. + + * Fixed test cases for mircColor and sorted (thanks dcraven). + + * Updated assertAction's error message to give useful information + about what went wrong. + 2006-07-23 James Vega * Version 0.83.2! (A long overdue bugfix release) diff --git a/RELNOTES b/RELNOTES index f9d41ea12..0863f230d 100644 --- a/RELNOTES +++ b/RELNOTES @@ -1,3 +1,9 @@ +Version 0.83.3 + +Overdue bug fix and Python2.5-compatible release. No significant changes to +worry about from the user perspective. + + Version 0.83.2 Mainly bug fix release. The most noticeable change being a value of diff --git a/plugins/Misc/plugin.py b/plugins/Misc/plugin.py index 6d81999e4..b9cf4947c 100644 --- a/plugins/Misc/plugin.py +++ b/plugins/Misc/plugin.py @@ -63,6 +63,7 @@ class Misc(callbacks.Plugin): maximum = conf.supybot.abuse.flood.command.invalid.maximum() self.invalidCommands.enqueue(msg) if self.invalidCommands.len(msg) > maximum and \ + conf.supybot.abuse.flood.command.invalid() and \ not ircdb.checkCapability(msg.prefix, 'owner'): punishment = conf.supybot.abuse.flood.command.invalid.punishment() banmask = '*!%s@%s' % (msg.user, msg.host) diff --git a/plugins/RSS/config.py b/plugins/RSS/config.py index e0fa198ea..f36e9dc4b 100644 --- a/plugins/RSS/config.py +++ b/plugins/RSS/config.py @@ -40,7 +40,7 @@ def configure(advanced): conf.registerPlugin('RSS', True) -class AnnouncedFeeds(registry.SpaceSeparatedListOfStrings): +class FeedNames(registry.SpaceSeparatedListOfStrings): List = callbacks.CanonicalNameSet RSS = conf.registerPlugin('RSS') @@ -55,15 +55,15 @@ conf.registerChannelValue(RSS, 'announcementPrefix', is prepended (if any) to the new news item announcements made in the channel.""")) conf.registerChannelValue(RSS, 'announce', - AnnouncedFeeds([], """Determines which RSS feeds should be announced in the - channel; valid input is a list of strings (either registered RSS feeds or - RSS feed URLs) separated by spaces.""")) + registry.SpaceSeparatedSetOfStrings([], """Determines which RSS feeds + should be announced in the channel; valid input is a list of strings + (either registered RSS feeds or RSS feed URLs) separated by spaces.""")) conf.registerGlobalValue(RSS, 'waitPeriod', registry.PositiveInteger(1800, """Indicates how many seconds the bot will wait between retrieving RSS feeds; requests made within this period will return cached results.""")) conf.registerGlobalValue(RSS, 'feeds', - AnnouncedFeeds([], """Determines what feeds should be accessible as + FeedNames([], """Determines what feeds should be accessible as commands.""")) conf.registerChannelValue(RSS, 'showLinks', registry.Boolean(False, """Determines whether the bot will list the link diff --git a/plugins/RSS/plugin.py b/plugins/RSS/plugin.py index 56ff9adc1..9edff10bc 100644 --- a/plugins/RSS/plugin.py +++ b/plugins/RSS/plugin.py @@ -416,11 +416,11 @@ class RSS(callbacks.Plugin): when = 'time unavailable' title = conv(info.get('title', 'unavailable')) desc = conv(info.get('description', 'unavailable')) + link = conv(info.get('link', 'unavailable')) # The rest of the entries are all available in the channel key response = format('Title: %s; URL: %u; ' 'Description: %s; Last updated: %s.', - title, info.get('link', 'unavailable').strip(), - desc, when) + title, link, desc, when) irc.reply(utils.str.normalizeWhitespace(response)) info = wrap(info, [first('url', 'feedName')]) diff --git a/scripts/supybot b/scripts/supybot index 541701e49..5ddd3668a 100644 --- a/scripts/supybot +++ b/scripts/supybot @@ -123,7 +123,7 @@ def main(): log.info('Total CPU time taken: %s seconds.', user+system) log.info('No more Irc objects, exiting.') -version = '0.83.2+darcs' +version = '0.83.3' if __name__ == '__main__': ### # Options: diff --git a/setup.py b/setup.py index 4c404b52f..a63cf184f 100644 --- a/setup.py +++ b/setup.py @@ -151,7 +151,7 @@ package_dir = {'supybot': 'src', for plugin in plugins: package_dir['supybot.plugins.' + plugin] = 'plugins/' + plugin -version = '0.83.2+darcs' +version = '0.83.3' setup( # Metadata name='supybot', diff --git a/src/conf.py b/src/conf.py index a7f220ff8..dfa7917e6 100644 --- a/src/conf.py +++ b/src/conf.py @@ -43,7 +43,7 @@ _pluginsDir = os.path.join(installDir, 'plugins') ### # version: This should be pretty obvious. ### -version = '0.83.2+darcs' +version = '0.83.3' ### # *** The following variables are affected by command-line options. They are diff --git a/src/ircmsgs.py b/src/ircmsgs.py index 9d65bbc0d..3d5a47e90 100644 --- a/src/ircmsgs.py +++ b/src/ircmsgs.py @@ -171,7 +171,7 @@ class IrcMsg(object): self.prefix == other.prefix and \ self.args == other.args __req__ = __eq__ # I don't know exactly what this does, but it can't hurt. - + def __ne__(self, other): return not (self == other) __rne__ = __ne__ # Likewise as above. @@ -317,6 +317,8 @@ def prettyPrint(msg, addRecipients=False, timestampFormat=None, showNick=True): s = '*** %s changes topic to %s' % (nickorprefix(), msg.args[1]) elif msg.command == 'NICK': s = '*** %s is now known as %s' % (msg.nick, msg.args[0]) + else: + s = utils.str.format('--- Unknown command %q', ' '.join(msg.args)) at = getattr(msg, 'receivedAt', None) if timestampFormat and at: s = '%s %s' % (time.strftime(timestampFormat, time.localtime(at)), s) diff --git a/src/log.py b/src/log.py index 786e39d49..c8d27d192 100644 --- a/src/log.py +++ b/src/log.py @@ -204,6 +204,7 @@ _stdoutHandler = StdoutStreamHandler(sys.stdout) class ValidLogLevel(registry.String): """Invalid log level.""" + handler = None minimumLevel = -1 def set(self, s): s = s.upper() @@ -216,6 +217,8 @@ class ValidLogLevel(registry.String): self.error() if level < self.minimumLevel: self.error() + if self.handler is not None: + self.handler.setLevel(level) self.setValue(level) def __str__(self): @@ -229,16 +232,12 @@ class ValidLogLevel(registry.String): class LogLevel(ValidLogLevel): """Invalid log level. Value must be either DEBUG, INFO, WARNING, ERROR, or CRITICAL.""" - def setValue(self, v): - ValidLogLevel.setValue(self, v) - _handler.setLevel(self.value) + handler = _handler class StdoutLogLevel(ValidLogLevel): """Invalid log level. Value must be either DEBUG, INFO, WARNING, ERROR, or CRITICAL.""" - def setValue(self, v): - ValidLogLevel.setValue(self, v) - _stdoutHandler.setLevel(self.value) + handler = _stdoutHandler conf.registerGroup(conf.supybot, 'log') conf.registerGlobalValue(conf.supybot.log, 'format',