From 0a2b6ea372e7f09dda2319af6d330848a2039f2c Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Mon, 14 May 2012 12:55:49 -0400 Subject: [PATCH] Do not die if missing revision metadata. 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 | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/xonstat/views/submission.py b/xonstat/views/submission.py index 631d93b..e2b7aaf 100755 --- a/xonstat/views/submission.py +++ b/xonstat/views/submission.py @@ -563,15 +563,21 @@ def stats_submit(request): log.debug("ERROR: Blank game") raise pyramid.httpexceptions.HTTPOk("OK") - # FIXME: if we have two players and game type is 'dm', - # change this into a 'duel' gametype. This should be - # removed when the stats actually send 'duel' instead of 'dm' + # the "duel" gametype is fake if num_real_players(players, count_bots=True) == 2 and \ game_meta['G'] == 'dm': game_meta['G'] = 'duel' + + # fix for DTG, who didn't #ifdef WATERMARK to set the revision info + try: + revision = game_meta['R'] + except: + revision = "unknown" + + log.debug(revision) server = get_or_create_server(session=session, hashkey=idfp, - name=game_meta['S'], revision=game_meta['R'], + name=game_meta['S'], revision=revision, ip_addr=get_remote_addr(request)) gmap = get_or_create_map(session=session, name=game_meta['M']) -- 2.39.2