Changeset 093448c


Ignore:
Timestamp:
Apr 29, 2015, 9:41:07 PM (11 years ago)
Author:
ASA Group Database <asa-db@…>
Branches:
master, stable
Children:
798afa8
Parents:
356174b
git-author:
Alex Dehnert <adehnert@…> (04/29/15 21:37:49)
git-committer:
ASA Group Database <asa-db@…> (04/29/15 21:41:07)
Message:

Make listdiff diff the GSC and UA Finboard lists too

Location:
asadb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • asadb/groups/listdiff.py

    r9af1bb4 r093448c  
    2020    funded_groups = active_groups.filter(group_class__slug='mit-funded')
    2121    return (
    22         #(
    23         #    util.mailinglist.MoiraList('finboard-groups-only'),
    24         #    funded_groups.filter(group_funding__slug='undergrad'),
    25         #),
    26         #(
    27         #    util.mailinglist.MailmanList('gsc-fb-'),
    28         #    funded_groups.filter(group_funding__slug='grad'),
    29         #),
     22        (
     23            util.mailinglist.MoiraList('finboard-groups-only'),
     24            funded_groups.filter(group_funding__slug='undergrad'),
     25            None,
     26        ),
     27        (
     28            util.mailinglist.MailmanList('gsc-fb-'),
     29            funded_groups.filter(group_funding__slug='grad'),
     30            None,
     31        ),
    3032        (
    3133            util.mailinglist.MailmanList('asa-official'),
  • asadb/util/mailinglist.py

    rfbdde0b r093448c  
    2828
    2929    def list_members(self, ):
    30         raise NotImplementedError
     30        env = dict(KRB5CCNAME=self.ccache.name)
    3131        res = subprocess.Popen(
    3232            [BLANCHE_PATH, self.name, ],
    3333            stdout=subprocess.PIPE,
    3434            stderr=subprocess.PIPE,
     35            env=env,
    3536        )
    3637        stdout, stderr = res.communicate()
    3738        if res.returncode:
    3839            raise RuntimeError("Failed to list members: %s" % (stderr, ))
    39         members = stdout.strip().split("\n")
     40        members = [self.convert_moira_to_email(m) for m in stdout.strip().split("\n")]
    4041        return members
     42
     43    def convert_moira_to_email(self, email):
     44        typ, colon, val = email.partition(":")
     45        if typ in ('STRING', 'USER', 'LIST'):
     46            email = val + "@mit.edu"
     47        # Leave untouched: KERBEROS (shouldn't exist), untagged strings
     48        assert email.count('@') == 1, "%s has wrong number of @'s" % (email, )
     49        return email
    4150
    4251    def strip_mit(self, email):
Note: See TracChangeset for help on using the changeset viewer.