diff --git a/ceo/console/main.py b/ceo/console/main.py index f43150d..434f49b 100644 --- a/ceo/console/main.py +++ b/ceo/console/main.py @@ -5,12 +5,14 @@ from ceo.console.memberlist import MemberList from ceo.console.updateprograms import UpdatePrograms from ceo.console.expiredaccounts import ExpiredAccounts from ceo.console.inactive import Inactive +from ceo.console.mathsoclist import MathSocList commands = { 'memberlist' : MemberList(), 'updateprograms' : UpdatePrograms(), 'expiredaccounts' : ExpiredAccounts(), 'inactive': Inactive(), + 'mathsoclist' : MathSocList(), } help_opts = [ '--help', '-h' ] diff --git a/ceo/console/mathsoclist.py b/ceo/console/mathsoclist.py new file mode 100644 index 0000000..d977665 --- /dev/null +++ b/ceo/console/mathsoclist.py @@ -0,0 +1,29 @@ +from ceo import members, terms +import re + +class MathSocList: + help = ''' +mathsoclist + +Prints a current list of members that are likely to be paying MathSoc members. +''' + + regex = ".*(mat/|vpa/se|computer science|math).*" + noinc = [ "dtbartle", "dlgawley", "cpdohert", "mbiggs", "tmyklebu" ] + + def main(self, args): + regex = re.compile(self.regex) + mlist = members.list_term(terms.current()) + dns = mlist.keys() + dns.sort() + for dn in dns: + member = mlist[dn] + if member['uid'][0] in self.noinc: + continue + program = member.get('program', [''])[0] + if regex.match(program.lower()) != None: + print '%s %s %s' % ( + member['uid'][0].ljust(12), + member['cn'][0].ljust(30), + member.get('program', [''])[0] + )