def leaderboard_values(self, user_ref, acc_ref, height, width): leader_ref = None if not acc_ref: leader_ref = Leaderboard() else: try: leader_ref = acc_ref.leaderWidget if leader_ref == None: leader_ref = widgets_dao.add_leader(acc_ref) except: leader_ref = widgets_dao.add_leader(acc_ref) # here we get the custom rank settings ret = {"status":"success"} ret['users'] = get_top_users(acc_ref) for ii in leader_ref.properties(): ret[ii] = getattr(leader_ref, ii) # Internal div's need to be slighy smaller than the iframe if width and height: try: width = int(width) height = int(height) # How did I get this equation? Trial and error. height = height - 2 *int(ret['borderThickness']) - 8 width = width - 2 *int(ret['borderThickness']) - 8 ret['height'] = height ret['width'] = width except: pass return ret
def get_leaderboard_properties_to_render(email): return get_values("Leaderboard", email, Leaderboard.properties())