This is an automated email from the ASF dual-hosted git repository. gcruz pushed a commit to branch akismet-update in repository https://gitbox.apache.org/repos/asf/allura.git
commit 0628922bec81f44764fdeee5bc41282248f5205d Author: Guillermo Cruz <[email protected]> AuthorDate: Wed Apr 24 10:11:26 2024 -0600 code updates to AkismetWithoutStartupVerify --- Allura/allura/lib/spam/akismetfilter.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Allura/allura/lib/spam/akismetfilter.py b/Allura/allura/lib/spam/akismetfilter.py index 1ed46ed10..c4c85d2d0 100644 --- a/Allura/allura/lib/spam/akismetfilter.py +++ b/Allura/allura/lib/spam/akismetfilter.py @@ -35,11 +35,16 @@ log = logging.getLogger(__name__) if AKISMET_AVAILABLE: - class AkismetWithoutStartupVerify(akismet.Akismet): + class AkismetWithoutStartupVerify(akismet.SyncClient): def __init__(self, key=None, blog_url=None): # avoid possible errors at instantiation time, will encounter them later self.api_key = key self.blog_url = blog_url + self._config = akismet.Config(key=key, url=blog_url) + akismet_client = akismet.SyncClient(config=self._config) + self._http_client = akismet_client._http_client + if not akismet_client.verify_key(self._config.key, self._config.url): + raise Exception('Akismet key verification failed') class AkismetSpamFilter(SpamFilter):
