From 4128d661e981e887019a448762c6b912de5efb6b Mon Sep 17 00:00:00 2001 From: rick Date: Sat, 8 May 2010 15:56:29 +0000 Subject: [PATCH] Fixed akismet settings and object instantiation code git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@173 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- forum/akismet.py | 3 +-- forum/models/node.py | 17 +++++------------ forum/settings/extkeys.py | 17 ++++------------- 3 files changed, 10 insertions(+), 27 deletions(-) diff --git a/forum/akismet.py b/forum/akismet.py index 4138d5a..7513d9d 100644 --- a/forum/akismet.py +++ b/forum/akismet.py @@ -119,8 +119,7 @@ class Akismet(object): if agent is None: agent = DEFAULTAGENT % __version__ self.user_agent = user_agent % (agent, __version__) - self.key = str(settings.WORDPRESS_API_KEY) - self.blog_url = str(settings.WORDPRESS_BLOG_URL) + self.setAPIKey(key, blog_url) def _getURL(self): diff --git a/forum/models/node.py b/forum/models/node.py index dc292fb..19973e9 100644 --- a/forum/models/node.py +++ b/forum/models/node.py @@ -257,18 +257,11 @@ class Node(BaseModel, NodeContent): @staticmethod def isSpam(comment, data): - #api = Akismet() - - #if not api.key: - # return False - #else: - # if api.comment_check(comment, data): - # return True - # else: - # return False - # return data - return False - + if not settings.WORDPRESS_API_KEY: + return False + + api = Akismet(settings.WORDPRESS_API_KEY, settings.APP_URL) + return api.comment_check(comment, data) class Meta: app_label = 'forum' diff --git a/forum/settings/extkeys.py b/forum/settings/extkeys.py index 9b38a16..16afd7c 100644 --- a/forum/settings/extkeys.py +++ b/forum/settings/extkeys.py @@ -13,16 +13,7 @@ label = _("Google analytics key"), help_text = _("Your Google analytics key. You can get one at the Google analytics official website"), required=False)) -#WORDPRESS_API_KEY = Setting('WORDPRESS_API_KEY', '', EXT_KEYS_SET, dict( -#label = _("Wordpress API key"), -#help_text = _("Your Wordpress API key. You can get one at http://wordpress.com/"), -#required=False)) - -#WORDPRESS_BLOG_URL = Setting('WORDPRESS_BLOG_URL', '', EXT_KEYS_SET, dict( -#label = _("Wordpress blog url"), -#help_text = _("Your Wordpress blog url. You can get one at http://wordpress.com/"), -#required=False)) - - - - +WORDPRESS_API_KEY = Setting('WORDPRESS_API_KEY', '', EXT_KEYS_SET, dict( +label = _("Wordpress API key"), +help_text = _("Your Wordpress API key. You can get one at http://wordpress.com/"), +required=False)) -- 2.39.5