Commits

David Chambers committed 897fe52

Added `ip_address` to `create_post` arguments. This is useful as Disqus allows blacklisting by IP address.

Comments (0)

Files changed (1)

 import hashlib
 import os
 import re
+import urllib
 
 import disqus
 
                         message = form.cleaned_data['message']
                         subscribe = form.cleaned_data['subscribe']
 
+                        try:
+                            ip_address = urllib.urlopen('http://www.whatismyip.com/automation/n09230945.asp').readlines()[0]
+                        except:
+                            ip_address = None
+
                         # send request to Disqus
-                        comment = dsq.create_post(forum=forum, thread=thread, message=message,
+                        comment = dsq.create_post(forum, thread, message=message, ip_address=ip_address,
                                 author_name=author_name, author_email=author_email, author_url=author_url)
 
                         # store comment so that it can be displayed to the author even if withheld for moderation