Add mathsoclist command
This commit is contained in:
parent
755d835eec
commit
fdcff72d83
|
@ -5,12 +5,14 @@ from ceo.console.memberlist import MemberList
|
||||||
from ceo.console.updateprograms import UpdatePrograms
|
from ceo.console.updateprograms import UpdatePrograms
|
||||||
from ceo.console.expiredaccounts import ExpiredAccounts
|
from ceo.console.expiredaccounts import ExpiredAccounts
|
||||||
from ceo.console.inactive import Inactive
|
from ceo.console.inactive import Inactive
|
||||||
|
from ceo.console.mathsoclist import MathSocList
|
||||||
|
|
||||||
commands = {
|
commands = {
|
||||||
'memberlist' : MemberList(),
|
'memberlist' : MemberList(),
|
||||||
'updateprograms' : UpdatePrograms(),
|
'updateprograms' : UpdatePrograms(),
|
||||||
'expiredaccounts' : ExpiredAccounts(),
|
'expiredaccounts' : ExpiredAccounts(),
|
||||||
'inactive': Inactive(),
|
'inactive': Inactive(),
|
||||||
|
'mathsoclist' : MathSocList(),
|
||||||
}
|
}
|
||||||
help_opts = [ '--help', '-h' ]
|
help_opts = [ '--help', '-h' ]
|
||||||
|
|
||||||
|
|
|
@ -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]
|
||||||
|
)
|
Loading…
Reference in New Issue