]> de.git.xonotic.org Git - xonotic/xonstat.git/commitdiff
Use utcnow for submissions. Set REMOTE_ADDR.
authorAnt Zucaro <azucaro@gmail.com>
Mon, 19 Dec 2011 01:49:18 +0000 (20:49 -0500)
committerAnt Zucaro <azucaro@gmail.com>
Mon, 19 Dec 2011 01:49:18 +0000 (20:49 -0500)
xonstat/views/submission.py

index 245fe304cc7e6c929876726cc3b96909a074b45a..e0456be3783d3947e965f3268e869653c23c7050 100755 (executable)
@@ -1,5 +1,6 @@
 import datetime\r
 import logging\r
+import os\r
 import pyramid.httpexceptions\r
 import re\r
 import time\r
@@ -17,7 +18,7 @@ def get_remote_addr(request):
     if 'X-Server-IP' in request.headers:\r
         return request.headers['X-Server-IP']\r
     else:\r
-        return request.remote_addr\r
+        return os.environ.get('HTTP_X_FORWARDED_FOR', request.remote_addr)\r
 \r
 \r
 def is_supported_gametype(gametype):\r
@@ -548,9 +549,12 @@ def stats_submit(request):
 \r
         gmap = get_or_create_map(session=session, name=game_meta['M'])\r
 \r
+        # FIXME: use the gmtime instead of utcnow() when the timezone bug is\r
+        # fixed\r
         game = create_game(session=session, \r
-                start_dt=datetime.datetime(\r
-                    *time.gmtime(float(game_meta['T']))[:6]), \r
+                start_dt=datetime.datetime.utcnow(),\r
+                #start_dt=datetime.datetime(\r
+                    #*time.gmtime(float(game_meta['T']))[:6]), \r
                 server_id=server.server_id, game_type_cd=game_meta['G'], \r
                    map_id=gmap.map_id, match_id=game_meta['I'])\r
 \r