diff --git a/NEWS b/NEWS index cd3c31efd7..2a3ebe6c11 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,23 @@ This file is used to auto-generate the "Changelog" section of Sopel's website. When adding new entries, follow the style guide in NEWS.spec.md to avoid causing problems with the site build. +Changes between 6.6.4 and 6.6.5 +=============================== + +Module changes +-------------- + +* Fixed url module not cleaning punctuation when auto-titling [[#1515][]] +* Fixed url module's punctuation-cleaning on Python 2 [[#1517][]] +* Fixed `.redditor` command with newer `praw` versions (4.0+) [[#1506][]] +* Reloading modules now runs their `shutdown()` routines [[#1412][]] + + [#1412]: https://github.com/sopel-irc/sopel/pull/1412 + [#1506]: https://github.com/sopel-irc/sopel/pull/1506 + [#1515]: https://github.com/sopel-irc/sopel/pull/1515 + [#1517]: https://github.com/sopel-irc/sopel/pull/1517 + + Changes between 6.6.3 and 6.6.4 =============================== diff --git a/sopel/__init__.py b/sopel/__init__.py index 5e9213fee7..8cf89be400 100644 --- a/sopel/__init__.py +++ b/sopel/__init__.py @@ -26,7 +26,7 @@ from collections import namedtuple import re -__version__ = '6.6.4' +__version__ = '6.6.5' def _version_info(version=__version__): diff --git a/sopel/bot.py b/sopel/bot.py index 8b6e41a71a..7e0fefc866 100644 --- a/sopel/bot.py +++ b/sopel/bot.py @@ -578,6 +578,8 @@ def _shutdown(self): shutdown_method.__module__, e ) ) + # Avoid calling shutdown methods if we already have. + self.shutdown_methods = [] def cap_req(self, module_name, capability, arg=None, failure_callback=None, success_callback=None): diff --git a/sopel/modules/reddit.py b/sopel/modules/reddit.py index e6ab1d9fa0..263f7c215b 100644 --- a/sopel/modules/reddit.py +++ b/sopel/modules/reddit.py @@ -119,8 +119,10 @@ def redditor_info(bot, trigger, match=None): client_secret=None, ) match = match or trigger - try: + try: # praw <4.0 style u = r.get_redditor(match.group(2)) + except AttributeError: # praw >=4.0 style + u = r.redditor(match.group(2)) except Exception: # TODO: Be specific if commanded: bot.say('No such Redditor.') diff --git a/sopel/modules/reload.py b/sopel/modules/reload.py index 87c428ada8..9b4592880a 100644 --- a/sopel/modules/reload.py +++ b/sopel/modules/reload.py @@ -11,7 +11,7 @@ import collections import sys import time -from sopel.tools import iteritems +from sopel.tools import stderr, iteritems import sopel.loader import sopel.module import subprocess @@ -65,6 +65,22 @@ def reload_module_tree(bot, name, seen=None, silent=False): old_callables = {} for obj_name, obj in iteritems(vars(old_module)): if callable(obj): + if (getattr(obj, '__name__', None) == 'shutdown' and + obj in bot.shutdown_methods): + # If this is a shutdown method, call it first. + try: + stderr( + "calling %s.%s" % ( + obj.__module__, obj.__name__, + ) + ) + obj(bot) + except Exception as e: + stderr( + "Error calling shutdown method for module %s:%s" % ( + obj.__module__, e + ) + ) bot.unregister(obj) elif (type(obj) is ModuleType and obj.__name__.startswith(name + '.') and diff --git a/sopel/modules/url.py b/sopel/modules/url.py index be7ce04fa4..fc45a75b29 100644 --- a/sopel/modules/url.py +++ b/sopel/modules/url.py @@ -100,7 +100,7 @@ def trim_url(url): # clean unmatched parentheses/braces/brackets for (opener, closer) in [('(', ')'), ('[', ']'), ('{', '}'), ('<', '>')]: - if url[-1] is closer and url.count(opener) < url.count(closer): + if (url[-1] == closer) and (url.count(opener) < url.count(closer)): url = url[:-1] return url @@ -167,7 +167,7 @@ def title_auto(bot, trigger): if bot.memory['safety_cache'][trigger]['positives'] > 1: return - urls = find_urls(trigger) + urls = find_urls(trigger, clean=True) if len(urls) == 0: return