"""General helper functions for the student section. """ from random import SystemRandom as r def generate_student_id(students,letter): if letter == '?': letter= r().choice('ABCDEFGHKLMNPQRSTUVWXY') sid = u"%c%d" % (letter,r().randint(99999,1000000)) while sid in students.keys(): sid = u"%c%d" % (letter,r().randint(99999,1000000)) return sid def set_returning_data(student): student['studycourse'].current_level += 100 student['studycourse'].current_session += 1 verdict = student['studycourse'].current_verdict student['studycourse'].current_verdict = '0' student['studycourse'].previous_verdict = verdict return