]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
add some log output
authorJan Behrens <zykure@web.de>
Wed, 8 Jan 2014 18:05:01 +0000 (19:05 +0100)
committerJan Behrens <zykure@web.de>
Wed, 8 Jan 2014 18:05:01 +0000 (19:05 +0100)
xonstat/__init__.py
xonstat/util.py
xonstat/views/player.py

index 0433461732e1160bda14af816e568f164bb600ce..49493d8cfb53bc5dda2406da3be9598b92c59ad7 100644 (file)
@@ -45,8 +45,7 @@ def main(global_config, **settings):
     config.add_route("player_game_index_json", "/player/{player_id:\d+}/games.json")
     config.add_view(player_game_index_json, route_name="player_game_index_json", renderer="jsonp")
 
-    #config.add_route("player_hashkey_info_text", "/player/me")
-    config.add_route("player_hashkey_info_text", "/player/{hashkey}")
+    config.add_route("player_hashkey_info_text", "/player/me")
     config.add_view(player_hashkey_info_text, route_name="player_hashkey_info_text", renderer="player_hashkey_info_text.mako")
 
     config.add_route("player_info",      "/player/{id:\d+}")
index d8599303c324f332cf3dbbbe38c568989834c002..0891765759356d3c1095985e64fe300a06d23fa0 100644 (file)
@@ -1,3 +1,4 @@
+import sys
 import logging
 import pyramid.httpexceptions
 import re
@@ -261,9 +262,8 @@ def verify_request(request):
                 sig=request.headers['X-D0-Blind-Id-Detached-Signature'],
                 querystring='',
                 postdata=request.body)
-
-        log.debug('\nidfp: {0}\nstatus: {1}'.format(idfp, status))
     except:
+        log.debug('ERROR: Could not verify request: {0}'.format(sys.exc_info()))
         idfp = None
         status = None
 
index 87967b9e3d23e04deeb8c5d0ec697f45784b7329..38fced4969237c3d1109a73cb7308c729f336bbd 100644 (file)
@@ -789,9 +789,10 @@ def player_damage_json(request):
 
 def player_hashkey_info_data(request):
     (idfp, status) = verify_request(request)
-    print "player_hashkey_info_data [idfp={0} status={1}]".format(idfp, status)
+    log.debug("d0_blind_id verification: idfp={0} status={1}\n".format(idfp, status))
 
-    hashkey = request.matchdict['hashkey']
+    log.debug("\n----- BEGIN REQUEST BODY -----\n" + request.body +
+            "----- END REQUEST BODY -----\n\n")
 
     # if config is to *not* verify requests and we get nothing back, this
     # query will return nothing and we'll 404.
@@ -799,7 +800,7 @@ def player_hashkey_info_data(request):
         player = DBSession.query(Player).\
                 filter(Player.player_id == Hashkey.player_id).\
                 filter(Player.active_ind == True).\
-                filter(Hashkey.hashkey == hashkey).one()
+                filter(Hashkey.hashkey == idfp).one()
 
         games_played   = get_games_played(player.player_id)
         overall_stats  = get_overall_stats(player.player_id)
@@ -811,7 +812,7 @@ def player_hashkey_info_data(request):
         raise pyramid.httpexceptions.HTTPNotFound
 
     return {'player':player,
-            'hashkey':hashkey,
+            'hashkey':idfp,
             'games_played':games_played,
             'overall_stats':overall_stats,
             'fav_maps':fav_maps,
@@ -908,8 +909,13 @@ def player_elo_info_data(request):
     """
     Provides elo information on a specific player. Raw data is returned.
     """
+    (idfp, status) = verify_request(request)
+    log.debug("d0_blind_id verification: idfp={0} status={1}\n".format(idfp, status))
+
     hashkey = request.matchdict['hashkey']
-    print "player_elo_info_data [hashkey={0}]".format(hashkey)
+    log.debug("\n----- BEGIN REQUEST BODY -----\n" + request.body +
+            "----- END REQUEST BODY -----\n\n")
+
     try:
         player = DBSession.query(Player).\
                 filter(Player.player_id == Hashkey.player_id).\