]> de.git.xonotic.org Git - xonotic/xonstat.git/commitdiff
Do not die if missing revision metadata.
authorAnt Zucaro <azucaro@gmail.com>
Mon, 14 May 2012 16:55:49 +0000 (12:55 -0400)
committerAnt Zucaro <azucaro@gmail.com>
Mon, 14 May 2012 16:55:49 +0000 (12:55 -0400)
The Xonotic revision metadata comes as a part of the 'R'
line in the POST. Although it isn't required, server was dying
when it was missing. I made it optional now, defaulting
that field to "unkown" when it isn't present. Note: DTG
brought this issue into the light, as they custom compile
their Xonotic, and they omit #ifdef'ing WARPZONE, which
is what prints the 'R' line in stats.

xonstat/views/submission.py

index 631d93b0f3bb3207c46599ea56af761ff5e86348..e2b7aaf62e36c21351517b430aaca01eefb7a2e3 100755 (executable)
@@ -563,15 +563,21 @@ def stats_submit(request):
             log.debug("ERROR: Blank game")\r
             raise pyramid.httpexceptions.HTTPOk("OK")\r
 \r
-        # FIXME: if we have two players and game type is 'dm',\r
-        # change this into a 'duel' gametype. This should be\r
-        # removed when the stats actually send 'duel' instead of 'dm'\r
+        # the "duel" gametype is fake\r
         if num_real_players(players, count_bots=True) == 2 and \\r
                 game_meta['G'] == 'dm':\r
             game_meta['G'] = 'duel'\r
 \r
+\r
+        # fix for DTG, who didn't #ifdef WATERMARK to set the revision info\r
+        try:\r
+            revision = game_meta['R']\r
+        except:\r
+            revision = "unknown"\r
+\r
+        log.debug(revision)\r
         server = get_or_create_server(session=session, hashkey=idfp, \r
-                name=game_meta['S'], revision=game_meta['R'],\r
+                name=game_meta['S'], revision=revision,\r
                 ip_addr=get_remote_addr(request))\r
 \r
         gmap = get_or_create_map(session=session, name=game_meta['M'])\r