Last change
on this file since 6652 was
6651,
checked in by Henrik Bettermann, 14 years ago
|
Generate student ids randomly (tests will follow).
|
-
Property svn:keywords set to
Id
|
File size:
418 bytes
|
Line | |
---|
1 | """General helper functions for the student section. |
---|
2 | """ |
---|
3 | |
---|
4 | import random |
---|
5 | from waeup.sirp.students.catalog import search |
---|
6 | |
---|
7 | def generate_student_id(letter): |
---|
8 | r = random |
---|
9 | if letter == '?': |
---|
10 | letter= r.choice('ABCDEFGHKLMNPQRSTUVWXY') |
---|
11 | sid = "%c%d" % (letter,r.randint(99999,1000000)) |
---|
12 | while search(query=sid,searchtype='student_id'): |
---|
13 | sid = "%c%d" % (letter,r.randint(99999,1000000)) |
---|
14 | return sid |
---|
Note: See
TracBrowser for help on using the repository browser.