Skip to content

Instantly share code, notes, and snippets.

@tmc
Created November 24, 2008 22:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmc/28674 to your computer and use it in GitHub Desktop.
Save tmc/28674 to your computer and use it in GitHub Desktop.
iff --git a/contrib/comments/views/comments.py b/contrib/comments/views/comments.py
index 3279543..d991f0a 100644
--- a/contrib/comments/views/comments.py
+++ b/contrib/comments/views/comments.py
@@ -87,6 +87,10 @@ def post_comment(request, next=None):
# Otherwise create the comment
comment = form.get_comment_object()
comment.ip_address = request.META.get("REMOTE_ADDR", None)
+
+ if ',' in comment.ip_address:
+ comment.ip_address = comment.ip_address.split(',')[0]
+
if request.user.is_authenticated():
comment.user = request.user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment