Changeset e5c5180
- Timestamp:
- Feb 11, 2014, 2:05:46 AM (12 years ago)
- Branches:
- master, stable, stage
- Children:
- ff71c3a, 8442dd7
- Parents:
- 4193cf3 (diff), 86986f5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - git-author:
- Alex Dehnert <adehnert@…> (02/11/14 02:05:46)
- git-committer:
- Alex Dehnert <adehnert@…> (02/11/14 02:05:46)
- File:
-
- 1 edited
-
asadb/forms/models.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
asadb/forms/models.py
r4193cf3 r86986f5 3 3 import json 4 4 import os 5 import re 5 6 6 7 import ldap … … 213 214 214 215 class PeopleStatusLookup(models.Model): 215 people = models.TextField(help_text="Enter some usernames or email addresses to look up here.")216 people = models.TextField(help_text="Enter some usernames or email addresses, separated by newlines, to look up here.") 216 217 requestor = models.ForeignKey(User, null=True, blank=True, ) 217 218 referer = models.URLField(blank=True) … … 234 235 username_chunks.append(usernames[start:end]) 235 236 start = end 236 username_chunks.append(usernames[end:]) 237 print username_chunks 237 extra = usernames[end:] 238 if extra: 239 username_chunks.append(extra) 238 240 239 241 results = [] … … 244 246 results.extend(batch_results) 245 247 246 left = set( usernames)248 left = set([u.lower() for u in usernames]) 247 249 undergrads = [] 248 250 grads = [] … … 259 261 for result in results: 260 262 username = result[1]['uid'][0] 261 left.remove(username )263 left.remove(username.lower()) 262 264 affiliation = result[1].get('eduPersonAffiliation', ['secret'])[0] 263 265 if affiliation == 'student': … … 297 299 return results 298 300 301 def split_people(self): 302 splitted = re.split(r'[\n,]+', self.people) 303 people = [] 304 for name in splitted: 305 name = name.strip() 306 if len(name) > 2 and (name[0] == '(') and (name[-1] == ')'): 307 name = name[1:-1] 308 name = name.replace(' at ', '@') 309 if name: 310 people.append(name) 311 return people 312 299 313 def update_classified_people(self): 300 people = [p for p in [p.strip() for p in self.people.split('\n')] if p]314 people = self.split_people() 301 315 self._classified_people = self.classify_people(people) 302 316 self.classified_people_json = json.dumps(self._classified_people)
Note: See TracChangeset
for help on using the changeset viewer.