Refactor uwldap constants

pull/5/head
David Bartley 15 years ago
parent a5e52e0178
commit 6bec583059
  1. 7
      ceo/console/main.py
  2. 4
      ceo/urwid/newmember.py
  3. 2
      ceo/urwid/widgets.py
  4. 8
      ceo/uwldap.py

@ -3,9 +3,6 @@ from getopt import getopt
from ceo import members, terms
import ceo.ldapi as ldapi
uwldap_uri = "ldap://uwldap.uwaterloo.ca/"
uwldap_base = "dc=uwaterloo,dc=ca"
shortopts = [
]
@ -39,11 +36,11 @@ def memberlist(args):
def updateprogram(args):
mlist = members.list_all().items()
uwldap = ldap.initialize(uwldap_uri)
uwldap = ldap.initialize(uwldap_uri())
fd = sys.stdin.fileno()
for (dn, member) in mlist:
uid = member['uid'][0]
user = uwldap.search_s(uwldap_base, ldap.SCOPE_SUBTREE,
user = uwldap.search_s(uwldap_base(), ldap.SCOPE_SUBTREE,
'(uid=%s)' % ldapi.escape(uid))
if len(user) == 0:
continue

@ -1,5 +1,5 @@
import ldap, urwid
from ceo import members, terms
from ceo import members, terms, uwldap
from ceo.urwid.widgets import *
from ceo.urwid.window import *
@ -51,7 +51,7 @@ class InfoPage(WizardPanel):
def init_widgets(self):
self.name = SingleEdit("Full name: ")
self.program = SingleEdit("Program of Study: ")
self.userid = LdapFilterWordEdit(uwldap_uri, uwldap_base, 'uid',
self.userid = LdapFilterWordEdit(uwldap.uri(), uwldap.base(), 'uid',
{'cn':self.name, 'ou':self.program}, "UWuserid: ")
self.widgets = [
urwid.Text( "Member Information - Please Check ID" ),

@ -2,8 +2,6 @@ import urwid, ldap
from ceo.urwid.window import raise_back, push_window
import ceo.ldapi as ldapi
uwldap_uri = "ldap://uwldap.uwaterloo.ca/"
uwldap_base = "dc=uwaterloo,dc=ca"
csclub_uri = "ldap://ldap1.csclub.uwaterloo.ca/ ldap://ldap2.csclub.uwaterloo.ca"
csclub_base = "dc=csclub,dc=uwaterloo,dc=ca"

@ -0,0 +1,8 @@
def uri():
return "ldap://uwldap.uwaterloo.ca/"
def base():
return "dc=uwaterloo,dc=ca"
def domain():
return 'uwaterloo.ca'
Loading…
Cancel
Save