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

« back to all changes in this revision

Viewing changes to bin/ivle-showenrolment

  • Committer: Matt Giuca
  • Date: 2010-07-28 06:09:00 UTC
  • Revision ID: matt.giuca@gmail.com-20100728060900-6a0lcuexcv1juh5r
ivle/webapp/submit/submit.html: Rewrote error message when an offering could not be found to submit to. This can have one of several causes, and the old error assumed it was because you weren't in a subject dir. Now enumerates the possible reasons. (LP: #526853)

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