Changeset ed7ddec for asadb/forms/models.py
- Timestamp:
- Dec 3, 2013, 12:21:44 AM (12 years ago)
- Branches:
- master, stable, stage
- Children:
- 200ae4b
- Parents:
- d66942f
- git-author:
- Alex Dehnert <adehnert@…> (12/03/13 00:19:10)
- git-committer:
- Alex Dehnert <adehnert@…> (12/03/13 00:21:44)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
asadb/forms/models.py
rd66942f red7ddec 226 226 fields = ['uid', 'eduPersonAffiliation', 'mitDirStudentYear'] 227 227 228 filters = [ldap.filter.filter_format('(uid=%s)', [u]) for u in usernames] 229 userfilter = "(|%s)" % (''.join(filters), ) 230 results = con.search_s(dn, ldap.SCOPE_SUBTREE, userfilter, fields) 228 chunk_size = 100 229 username_chunks = [] 230 ends = range(chunk_size, len(usernames), chunk_size) 231 start = 0 232 for end in ends: 233 username_chunks.append(usernames[start:end]) 234 start = end 235 username_chunks.append(usernames[end:]) 236 print username_chunks 237 238 results = [] 239 for chunk in username_chunks: 240 filters = [ldap.filter.filter_format('(uid=%s)', [u]) for u in chunk] 241 userfilter = "(|%s)" % (''.join(filters), ) 242 batch_results = con.search_s(dn, ldap.SCOPE_SUBTREE, userfilter, fields) 243 results.extend(batch_results) 231 244 232 245 left = set(usernames) … … 261 274 262 275 def classify_people(self, people): 263 mit_usernames = set()276 mit_usernames = [] 264 277 alum_addresses = [] 265 278 other_mit_addresses = [] … … 269 282 local, at, domain = name.partition('@') 270 283 if domain.lower() == 'mit.edu' or domain == '': 271 mit_usernames.a dd(local)284 mit_usernames.append(local) 272 285 elif domain.lower() == 'alum.mit.edu': 273 286 alum_addresses.append((name, None))
Note: See TracChangeset
for help on using the changeset viewer.