Commits

David Chambers  committed 9db69ba

akismet: don't explode if Referer header is absent

  • Participants
  • Parent commits 2cc221a

Comments (0)

Files changed (1)

                 'blog': mango.settings.BASE_URL,
                 'user_ip': self.request.META['REMOTE_ADDR'],
                 'user_agent': self.request.META.get('HTTP_USER_AGENT', ''),
-                'referrer': self.request.META['HTTP_REFERER'],
-                'permalink': self.request.META['HTTP_REFERER'],
                 'comment_type': 'comment',
                 'comment_author': self.cleaned_data['author_name'],
                 'comment_content': self.cleaned_data['message'],
             }
+            referrer = self.request.META.get('HTTP_REFERER')
+            if referrer is not None:
+                args['referrer'] = referrer
+                args['permalink'] = referrer
+
             if self.cleaned_data['author_url']:
                 args['comment_author_url'] = self.cleaned_data['author_url']