From: Ciro Scognamiglio <ciro.scognamiglio@cslash.net>
Date: Tue, 14 Apr 2015 13:16:09 +0000 (+0200)
Subject: fixed catch exception when looking for remote ip address
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=534f2abeda7d18495594bc290f1f7e0135b0c300;p=unfold.git

fixed catch exception when looking for remote ip address
---

diff --git a/activity/__init__.py b/activity/__init__.py
index 4719a61c..70381819 100644
--- a/activity/__init__.py
+++ b/activity/__init__.py
@@ -83,10 +83,10 @@ def log(request, action, message, objects = None):
     t.start()
 
 def getClientIp(request):
-    x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
-    if x_forwarded_for:
+    try :
+        x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
         ip = x_forwarded_for.split(',')[0]
-    else:
+    except:
         ip = request.META.get('REMOTE_ADDR')
     return ip