]> git.xonotic.org Git - xonotic/xonstat.git/commitdiff
Merge branch 'master' into zykure/wip
authorJan Behrens <zykure@web.de>
Wed, 8 Jan 2014 18:08:05 +0000 (19:08 +0100)
committerJan Behrens <zykure@web.de>
Wed, 8 Jan 2014 18:08:05 +0000 (19:08 +0100)
Conflicts:
xonstat/__init__.py
xonstat/views/player.py

xonstat/__init__.py
xonstat/util.py
xonstat/views/player.py

index c38d31c0790541339a0388162fc0c94f3ca50c76..f7bd04caf29ae474ff381013491c5d3a2486f798 100644 (file)
@@ -45,6 +45,9 @@ 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_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+}")
     config.add_view(player_info,      route_name="player_info",      renderer="player_info.mako")
 
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 19ec08165039cd55790f70f51dc757b8284ceb09..75e9ff8b5651759747dd69f74979e929d88160d9 100644 (file)
@@ -795,7 +795,11 @@ def player_hashkey_info_data(request):
     # hashkey = unquote(hashkey)
 
     # if using request verification to obtain the hashkey
-    (hashkey, status) = verify_request(request)
+    (idfp, status) = verify_request(request)
+    log.debug("d0_blind_id verification: idfp={0} status={1}\n".format(idfp, status))
+
+    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.
@@ -803,7 +807,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)
@@ -816,7 +820,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,
@@ -919,10 +923,18 @@ 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']
+<<<<<<< HEAD
+    log.debug("\n----- BEGIN REQUEST BODY -----\n" + request.body +
+            "----- END REQUEST BODY -----\n\n")
+=======
 
     # the incoming hashkey is double quoted, and WSGI unquotes once...
     hashkey = unquote(hashkey)
+>>>>>>> master
 
     try:
         player = DBSession.query(Player).\