48
def enrol_user(login, year=None):
50
Looks up the student in whatever modules are available.
51
The pulldown does not tell us what year to enrol the student for, so the
52
year may be specified (as a string). If unspecified, will enrol in the
53
current year according to the system clock.
54
If successful, enrols the student (in the database) in all subjects in the
55
system. Subjects which the pulldown tells us the student is in, but which
56
are not in the system are ignored.
57
Does not unenrol the student from any subjects.
58
Does not complain if the student is already enrolled in any subjects.
59
Raises a SubjectError if the pulldown module says so.
61
Returns the number of subjects the user was enrolled in (not including
62
subjects outside the system, or subjects already enrolled).
66
for subject, semester in get_subjects(login):
67
count += db.add_enrolment(login, subject, semester, year)
47
70
# Allow imports to get files from this directory.
48
71
# Get the directory that this module (authenticate) is in
49
72
plugpath = os.path.split(sys.modules[__name__].__file__)[0]