Exemplo n.º 1
0
 def get(self, mid=None, bgg_id=None):
     _trace = TRACE+'GameEdit:: '
     logging.info(_trace+'get(mid = '+mid+', bgg_id = '+bgg_id+')')
     game = gamebase.getGame(mid=mid, bgg_id=bgg_id)
     matches = gamebase.getBGGMatches(game.name, exact=False)
     template_values = {
         'game': game,
         'matches': matches
     }  
     generate(self, 'base_admin_game.html', template_values)
Exemplo n.º 2
0
def getGame(mid, bgg_id):
    """Returns JSON formated Game Response.
    """
    logging.info(TRACE+'getGame('+mid+','+bgg_id+')')    
    game = gamebase.getGame(mid, bgg_id)
    data = {'mid':game.mid, 
            'bgg_id':game.bgg_id, 
            'name':game.name,
            'description':game.description,
            'year_published':game.year_published,
            'playing_time':game.playing_time,
            'min_players':game.min_players,
            'max_players':game.max_players,
            'age':game.age,
            'publishers':game.publishers,
            'designers':game.designers,
            'expansions':game.expansions,
            'image_url':game.image_url}
    r = API200
    r['result'] = data
    return r
Exemplo n.º 3
0
 def get(self, mid=None, bgg_id=None):
     logging.info(TRACE+'GameProfile:: get()')
     user = self.current_user
     game = gamebase.getGame(mid=mid, bgg_id=bgg_id)
     if game is None:
         self.error(404)
         return            
     checkins = checkinbase.getGameCheckins(game, 4)
     high_scores = checkinbase.getGameHighScores(game, 4)
     host = self.request.host # used for Facebook Like url 
     checked_in = checkinbase.isCheckedIn(user)   
     admin = users.is_current_user_admin()  
     template_values = {
         'admin': admin,
         'checked_in': checked_in,
         'host': host,
         'game': game,
         'checkins': checkins,
         'high_scores': high_scores,
         'current_user': user,
         'facebook_app_id': FACEBOOK_APP_ID
     }  
     self.generate('base_game.html', template_values)