- Timestamp:
- 3 Sep 2011, 02:27:24 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/utils.py
r6651 r6662 2 2 """ 3 3 4 import random 4 from random import SystemRandom as r 5 5 from waeup.sirp.students.catalog import search 6 6 7 7 def generate_student_id(letter): 8 r = random8 # XXX: using catalog search here might be overkill? 9 9 if letter == '?': 10 10 letter= r.choice('ABCDEFGHKLMNPQRSTUVWXY') 11 sid = "%c%d" % (letter,r.randint(99999,1000000))11 sid = u"%c%d" % (letter,r.randint(99999,1000000)) 12 12 while search(query=sid,searchtype='student_id'): 13 sid = "%c%d" % (letter,r.randint(99999,1000000))13 sid = u"%c%d" % (letter,r.randint(99999,1000000)) 14 14 return sid
Note: See TracChangeset for help on using the changeset viewer.