示例#1
0
# Iterate through teams, fetch data, and create accounts.

count = 0
skipped = 0

for team_dot_yaml in team_yaml:
    team_leader, college_tla, teams, team_name = read_team_data(team_dot_yaml)

    # Does the desired college / team already exist?

    college = c_teams.get_college(college_tla)

    teamGroups = []
    for team in teams:
        teamGroup = c_teams.get_team(team)
        teamGroups.append(teamGroup)

    if college.in_db or len([x for x in teamGroups if x.in_db]) != 0:
        print >>sys.stderr, "College {0} or associated teams already in db, skipping import".format(college_tla)
        skipped += 1
        continue

    print >>sys.stderr, "Creating groups + account for {0}".format(college_tla)

    # Split at most once -- assume additional name parts go in the last name
    first_name, last_name = team_leader['name'].split(' ', 1)
    newname = sr.new_username(college_tla, first_name, last_name)
    u = sr.users.user(newname)

    u.cname = first_name
示例#2
0
def ensure_team(tla, user):
    grp = get_team(tla)
    grp.user_add(user)
    grp.save()
示例#3
0
def ensure_team(tla, user):
    grp = get_team(tla)
    grp.user_add(user)
    grp.save()
示例#4
0
# Iterate through teams, fetch data, and create accounts.

count = 0
skipped = 0

for team_dot_yaml in team_yaml:
    the_contact, college_tla, teams = read_team_data(team_dot_yaml)

    # Does the desired college / team already exist?

    college = c_teams.get_college(college_tla)

    teamGroups = []
    for team in teams:
        teamGroup = c_teams.get_team(team)
        teamGroups.append(teamGroup)

    if college.in_db or len([x for x in teamGroups if x.in_db]) != 0:
        print >>sys.stderr, "College {0} or associated teams already in db, skipping import".format(college_tla)
        skipped += 1
        continue

    print >>sys.stderr, "Creating groups + account for {0}".format(college_tla)

    first_name, last_name = the_contact['name'].split(' ')
    newname = sr.new_username(college_tla, first_name, last_name)
    u = sr.users.user(newname)

    u.cname = first_name
    u.sname = last_name
示例#5
0
# Iterate through teams, fetch data, and create accounts.

count = 0
skipped = 0

for info in teams_infos:
    college_tla = info['tla'].strip().upper()
    org_name = info['organisation_name'].strip()
    first_name = info['first_name'].strip()
    last_name = info['last_name'].strip()
    email = info['email'].strip()

    # Does the desired college / team already exist?

    college_group = c_teams.get_college(college_tla)
    team_group = c_teams.get_team(college_tla)

    if college_group.in_db or team_group.in_db:
        print("College {0} or associated teams already in db, skipping import".
              format(college_tla),
              file=sys.stderr)
        skipped += 1
        continue

    print("Creating groups + account for {0}".format(college_tla),
          file=sys.stderr)

    newname = sr.new_username(college_tla, first_name, last_name)
    u = sr.users.user(newname)

    u.cname = first_name