Example #1
0
 def _ask_akismet(self, comment, content_object, request):
     # Return True if akismet marks this comment as spam.
     from stopspam.utils import akismet_check
     akismet_data = {
             'comment_author': '' if not 'comment_author' in self.akismet_fields else getattr(comment, self.akismet_fields['comment_author']),
             'comment_author_email': '' if not 'comment_author_email' in self.akismet_fields else getattr(comment, self.akismet_fields['comment_author_email']),
             'comment_author_url': '' if not 'comment_author_url' in self.akismet_fields else getattr(comment, self.akismet_fields['comment_author_url']),
             'comment_content': '' if not 'comment_content' in self.akismet_fields else getattr(comment, self.akismet_fields['comment_content']),
         }
     
     return akismet_check(request=request, **akismet_data)
Example #2
0
 def akismet_check(self):
     fields = {}
     for key, value in self.akismet_fields.items():
         fields[key] = self.cleaned_data[value]
     return utils.akismet_check(self._request, akismet_api_key=self.akismet_api_key, **fields)