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

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

Fix missing calls.

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