30
30
if len(sys.argv) != 2:
31
31
print >> sys.stderr, "usage: %s <login>" % os.path.basename(sys.argv[0])
36
user = db.get_user(sys.argv[1])
37
except ivle.db.DBException:
38
print >> sys.stderr, "cannot retrieve user - probably doesn't exist"
34
store = ivle.database.get_store()
35
user = ivle.database.User.get_by_login(store, sys.argv[1])
38
print>>sys.stderr, "%s: user does not exist"%os.path.basename(sys.argv[0])
40
enrols = db.get_enrolment(sys.argv[1])
44
print 'Showing enrolment for %s (%s):' % (sys.argv[1], user.fullname)
41
if user.enrolments.count() > 0:
42
print 'IVLE enrolment for %s (%s):' % (user.login, user.fullname)
45
43
print ' Code Name Semester Year'
46
44
print '-------- ---------- -------- ----'
48
print '%(subj_code)8s %(subj_short_name)10s %(semester)8s %(year)4s' % enrol
45
for e in user.enrolments:
46
print '%8s %10s %8s %4s' % (
47
e.offering.subject.code, e.offering.subject.short_name,
48
e.offering.semester.semester, e.offering.semester.year
50
print '%s (%s) is not enrolled in any offerings' % (sys.argv[1], user.fullname)
51
print '%s (%s) is not enrolled in any IVLE offerings' % (
52
user.login, user.fullname)