config.add_route("player_info", "/player/{id:\d+}")
config.add_view(player_info, route_name="player_info", renderer="player_info.mako")
- config.add_route("player_hashkey_info_json", "/player/{hashkey:.{44}}.json")
+ config.add_route("player_hashkey_info_json", "/player/me.json")
config.add_view(player_hashkey_info_json, route_name="player_hashkey_info_json", renderer="jsonp")
config.add_route("player_hashkey_info_text", "/player/me")
config.add_route("player_elo_info_text", "/player/{hashkey}/elo.txt")
config.add_view(player_elo_info_text, route_name="player_elo_info_text", renderer="player_elo_info_text.mako")
- config.add_route("player_elo_info_json", "/player/{hashkey}/elo.json") ## FIXME - doesn't seem to work?
+ # FIXME - needs an additional method to convert to JSON
+ config.add_route("player_elo_info_json", "/player/{hashkey}/elo.json")
config.add_view(player_elo_info_json, route_name="player_elo_info_json", renderer="jsonp")
config.add_route("player_accuracy", "/player/{id:\d+}/accuracy")
from xonstat.util import page_url, to_json, pretty_date, datetime_seconds
from xonstat.util import is_cake_day, verify_request
from xonstat.views.helpers import RecentGame, recent_games_q
+from urllib import unquote
log = logging.getLogger(__name__)
def player_hashkey_info_data(request):
- (idfp, status) = verify_request(request)
+ # hashkey = request.matchdict['hashkey']
+
+ # the incoming hashkey is double quoted, and WSGI unquotes once...
+ # hashkey = unquote(hashkey)
+
+ # if using request verification to obtain the hashkey
+ (hashkey, status) = verify_request(request)
# if config is to *not* verify requests and we get nothing back, this
# query will return nothing and we'll 404.
player = DBSession.query(Player).\
filter(Player.player_id == Hashkey.player_id).\
filter(Player.active_ind == True).\
- filter(Hashkey.hashkey == idfp).one()
+ filter(Hashkey.hashkey == hashkey).one()
games_played = get_games_played(player.player_id)
overall_stats = get_overall_stats(player.player_id)
Provides elo information on a specific player. Raw data is returned.
"""
hashkey = request.matchdict['hashkey']
- print "player_elo_info_data [hashkey={0}]".format(hashkey)
+
+ # the incoming hashkey is double quoted, and WSGI unquotes once...
+ hashkey = unquote(hashkey)
+
try:
player = DBSession.query(Player).\
filter(Player.player_id == Hashkey.player_id).\