Skip to content
This repository
Browse code

Generate permalink for akismet API data with domain name

  • Loading branch information...
commit 46f4c516b709d40b06c25e58a7532abd35578a05 1 parent f82b27f
Diederik van der Boor vdboor authored

Showing 1 changed file with 7 additions and 3 deletions. Show diff stats Hide diff stats

  1. +7 3 fluent_comments/moderation.py
10 fluent_comments/moderation.py
... ... @@ -1,3 +1,4 @@
  1 +from urlparse import urljoin
1 2 from django.conf import settings
2 3 from django.contrib.comments.moderation import CommentModerator, moderator
3 4 from django.contrib.sites.models import get_current_site
@@ -104,16 +105,19 @@ def _akismet_check(self, comment, content_object, request):
104 105 if not AKISMET_API_KEY:
105 106 raise ImproperlyConfigured('You must set AKISMET_API_KEY to use comment moderation with Akismet.')
106 107
107   - auto_blog_url = '{0}://{1}/'.format(request.is_secure() and 'https' or 'http', get_current_site(request).domain)
  108 + current_domain = get_current_site(request).domain
  109 + auto_blog_url = '{0}://{1}/'.format(request.is_secure() and 'https' or 'http', current_domain)
  110 + blog_url = appsettings.AKISMET_BLOG_URL or auto_blog_url
  111 +
108 112 akismet_api = Akismet(
109 113 key=AKISMET_API_KEY,
110   - blog_url=appsettings.AKISMET_BLOG_URL or auto_blog_url
  114 + blog_url=blog_url
111 115 )
112 116
113 117 if akismet_api.verify_key():
114 118 akismet_data = {
115 119 # Comment info
116   - 'permalink': content_object.get_absolute_url(),
  120 + 'permalink': urljoin(blog_url, content_object.get_absolute_url()),
117 121 'comment_type': 'comment',
118 122 'comment_author': getattr(comment, 'name', ''),
119 123 'comment_author_email': getattr(comment, 'email', ''),

0 comments on commit 46f4c51

Please sign in to comment.
Something went wrong with that request. Please try again.