~daker/loco-team-portal/fix.777098

« back to all changes in this revision

Viewing changes to loco_directory/teams/management/commands/lpupdate.py

  • Committer: Tarmac
  • Author(s): Adnane Belmadiaf
  • Date: 2013-02-18 20:46:13 UTC
  • mfrom: (610.2.2 fix.668015)
  • Revision ID: tarmac@geekpad-20130218204613-0n2om0xec1wpizh9
[r=] Added the ability to add LC feed on LTP
Added the ability to add LC meetings on LTP
Added LC members on LTP

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
from datetime import datetime
12
12
import sys
13
13
 
 
14
import logging
 
15
st_handler = logging.StreamHandler(sys.stderr)
 
16
formatter = logging.Formatter("[%(asctime)s] - %(levelname)s - %(module)s - %(message)s")
 
17
st_handler.setFormatter(formatter)
 
18
 
 
19
log = logging.getLogger(__name__)
 
20
log.addHandler(st_handler)
 
21
log.setLevel(logging.DEBUG)
 
22
 
14
23
 
15
24
def create_admin_dict(admins):
16
25
    admin_dict = {}
69
78
        lp = launchpad.lp_login()
70
79
        if not lp:
71
80
            sys.exit(1)
72
 
        TEAM_BLACKLIST = (u"ubuntu-lococouncil", u"ubuntu-games-merged")
 
81
        TEAM_BLACKLIST = (u"ubuntu-games-merged")
73
82
 
74
83
        existing_locos = models.Team.objects.all()
75
84
        existing_groups = Group.objects.all()
80
89
                team = models.Team(lp_name=l.name, name=l.display_name,
81
90
                                   owner_profile=create_profile(get_team_owner(l).name))
82
91
                team.save()
 
92
                log.debug("Created team %s" % team.name)
83
93
            else:
84
94
                team = filter(lambda a: a.lp_name == l.name, existing_locos)[0]
85
95
                team.name = l.display_name
86
96
                team.owner_profile = create_profile(get_team_owner(l).name)
87
97
                if not len(team.contact_profiles.all()):
88
98
                    team.contact_profiles.add(team.owner_profile)
 
99
                log.debug("Updated team %s" % team.name)
89
100
            update_admins(team, l, lp)
90
101
 
91
102
            if not existing_groups or l.name not in [g.name for g in existing_groups]: