~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to bin/ivle-showenrolment

Added module ivle.config, which takes care of some work interfacing with
    configobj, including searching for the file and opening the object.
ivle.conf.conf now uses this instead of having its own search.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
import os
26
26
import sys
27
27
 
28
 
import ivle.config
29
28
import ivle.database
30
29
 
31
30
if len(sys.argv) != 2:
32
31
    print >> sys.stderr, "usage: %s <login>" % os.path.basename(sys.argv[0])
33
32
    sys.exit(1)
34
33
 
35
 
store = ivle.database.get_store(ivle.config.Config())
 
34
store = ivle.database.get_store()
36
35
user = ivle.database.User.get_by_login(store, sys.argv[1])
37
36
 
38
37
if not user:
41
40
 
42
41
if user.enrolments.count() > 0:
43
42
    print 'IVLE enrolment for %s (%s):' % (user.login, user.fullname)
44
 
    print '    Code       Name Year Semester     Role'
45
 
    print '-------- ---------- ---- -------- --------'
 
43
    print '    Code       Name Semester Year'
 
44
    print '-------- ---------- -------- ----'
46
45
    for e in user.enrolments:
47
 
        print '%8s %10s %4s %8s %8s' % (
 
46
        print '%8s %10s %8s %4s' % (
48
47
                e.offering.subject.code, e.offering.subject.short_name,
49
 
                e.offering.semester.year, e.offering.semester.semester,
50
 
                e.role
 
48
                e.offering.semester.semester, e.offering.semester.year
51
49
                )
52
50
else:
53
51
    print '%s (%s) is not enrolled in any IVLE offerings' % (