2c7489ba4df929b80877d3366f95b5b4897e95b2
[public/www-new.git] / bin / exec_positions.py
1 #!/usr/bin/python
2 import ldap, time, operator
3
4 #
5 # globals
6 #
7 cscUri = "http://csclub.uwaterloo.ca/xsltproc"
8 cscTerms = ["Winter", "Spring", "Fall"]
9 cscShortTerms = ['w', 's', 'f']
10 cscLdapUri = "ldap://ldap1.csclub.uwaterloo.ca ldap://ldap2.csclub.uwaterloo.ca"
11 cscLdap = None
12 cscPeopleBase = 'ou=People,dc=csclub,dc=uwaterloo,dc=ca'
13
14 def cscLdapConnect():
15     global cscLdap
16     cscLdap = ldap.initialize(cscLdapUri)
17     cscLdap.simple_bind_s("", "")
18
19 cscLdapConnect()
20
21 def showExec(pretty, short):
22     print "<p><b>" + pretty + "</b><br>"
23     members = cscLdap.search_s(cscPeopleBase, ldap.SCOPE_SUBTREE,
24              '(&(objectClass=member)(position=%s))' % short)
25     if len(members) > 0:
26       (_, user) = members[0]
27       print user['cn'][0]
28     else:
29       print 'Seat Empty'
30     print "</p>"
31
32 print "<h1>The Executive</h1>"
33 showExec("President", "president")
34 showExec("Vice-President", "vice-president")
35 showExec("Treasurer", "treasurer")
36 showExec("Secretary", "secretary")
37 showExec("Systems Administrator", "sysadmin")
38
39 print "<h1>Other Positions</h1>"
40 showExec("Chief Returning Officer", "cro")
41 showExec("Office Manager", "offsck")
42 showExec("Librarian", "librarian")
43
44 print "<h1>Elections</h1>"
45 print "<p>Each term the CSC holds elections to determine the executive council. To find out when and where the next elections will be held, check the homepage and the <a href=\"http://csclub.uwaterloo.ca/newsgroup/thread.php?group=uw.csc\">uw.csc</a> newsgroup.<br>"
46 print "</p><p>For details on the election rules, see the <a href=\"../Constitution\">constitution</a>."
47 print "</p>"