source: main/waeup.sirp/trunk/src/waeup/sirp/students/utils.py @ 6737

Last change on this file since 6737 was 6664, checked in by uli, 13 years ago

Fix missing calls.

  • Property svn:keywords set to Id
File size: 491 bytes
Line 
1"""General helper functions for the student section.
2"""
3
4from random import SystemRandom as r
5from waeup.sirp.students.catalog import search
6
7def generate_student_id(letter):
8    # XXX: using catalog search here might be overkill?
9    if letter == '?':
10        letter= r().choice('ABCDEFGHKLMNPQRSTUVWXY')
11    sid = u"%c%d" % (letter,r().randint(99999,1000000))
12    while search(query=sid,searchtype='student_id'):
13        sid = u"%c%d" % (letter,r().randint(99999,1000000))
14    return sid
Note: See TracBrowser for help on using the repository browser.