SHARE
TWEET

Untitled

a guest Aug 19th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from utils import SocialChannelUtils
  2. from google.appengine.ext.ndb import Key
  3. from blinkfire.user import SocialChannelOwners
  4. from generic.models.sport_model import *
  5.  
  6. club = Organization.get_by_id('oo_fnatic_14576061487')
  7. teams = club.get_teams
  8.  
  9. for t in teams:
  10.   try:
  11.     print '<table><tbody>'
  12.     print '<tr><td colspan="3" bgcolor="#DDDDDD"><strong>'
  13.     print t.name
  14.     print '</strong></td></tr>'
  15.     team = t.key.get()
  16.     for player in team.players:
  17.       channels = SocialChannelUtils.entity_channels_as_dict(player)
  18.       p = player.get()
  19.       print '<tr><td colspan="3" bgcolor="#EEEEEE"><strong>{}</strong></td></tr>'.format(p.name)
  20.       if all(type(channel) == int for channel in channels.values()):
  21.         print '<tr><td colspan="3">NO CHANNELS</td></tr>'
  22.         continue
  23.       owners = SocialChannelOwners.channel_owners_from_dict(channels)
  24.       for key, channel in channels.iteritems():
  25.         if not channel:
  26.           continue
  27.         has_credentials = key in owners
  28.         print "<tr><td>{}</td><td>{}</td><td>{}</td></tr>".format(channel.medium, channel.username, has_credentials)
  29.       print "<tr><td></td></tr>"
  30.       print "<tr><td></td></tr>"
  31.     print "</tbody></table>"
  32.     print "<br> <br>"
  33.   except Exception as e:
  34.     print e
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top