Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Generate permalink for akismet API data with domain name

  • Loading branch information...
commit 46f4c516b709d40b06c25e58a7532abd35578a05 1 parent f82b27f
Diederik van der Boor vdboor authored
Showing with 7 additions and 3 deletions.
  1. +7 −3 fluent_comments/moderation.py
10 fluent_comments/moderation.py
View
@@ -1,3 +1,4 @@
+from urlparse import urljoin
from django.conf import settings
from django.contrib.comments.moderation import CommentModerator, moderator
from django.contrib.sites.models import get_current_site
@@ -104,16 +105,19 @@ def _akismet_check(self, comment, content_object, request):
if not AKISMET_API_KEY:
raise ImproperlyConfigured('You must set AKISMET_API_KEY to use comment moderation with Akismet.')
- auto_blog_url = '{0}://{1}/'.format(request.is_secure() and 'https' or 'http', get_current_site(request).domain)
+ current_domain = get_current_site(request).domain
+ auto_blog_url = '{0}://{1}/'.format(request.is_secure() and 'https' or 'http', current_domain)
+ blog_url = appsettings.AKISMET_BLOG_URL or auto_blog_url
+
akismet_api = Akismet(
key=AKISMET_API_KEY,
- blog_url=appsettings.AKISMET_BLOG_URL or auto_blog_url
+ blog_url=blog_url
)
if akismet_api.verify_key():
akismet_data = {
# Comment info
- 'permalink': content_object.get_absolute_url(),
+ 'permalink': urljoin(blog_url, content_object.get_absolute_url()),
'comment_type': 'comment',
'comment_author': getattr(comment, 'name', ''),
'comment_author_email': getattr(comment, 'email', ''),
Please sign in to comment.
Something went wrong with that request. Please try again.