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

« back to all changes in this revision

Viewing changes to bin/ivle-enrolallusers

  • Committer: David Coles
  • Date: 2009-07-21 02:19:56 UTC
  • mto: (1281.1.8 aufsless)
  • mto: This revision was merged to the branch mainline in revision 1300.
  • Revision ID: coles.david@gmail.com-20090721021956-c1jiwu7fhi2dna1g
Updated to work on bind mounts

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
p.add_option('--user', '-u', metavar="<login>",
43
43
             help="Just perform enrolment for user <login>")
44
44
p.add_option('--verbose', '-v', action='store_true')
 
45
p.add_option('--year', '-y', metavar="<year>",
 
46
             help="If specified, year to make enrolments for (default: "
 
47
                  "current year)")
45
48
options, arguments = p.parse_args()
46
49
 
47
50
if options.verbose:
65
68
else:
66
69
    logging.info("enrolment started for user %s" % options.user)
67
70
 
 
71
if options.year is not None and not options.year.isdigit():
 
72
    logging.error("Year must be numeric")
 
73
    sys.exit(1)
 
74
 
 
75
options.year = None if options.year is None else unicode(options.year)
 
76
 
68
77
for user in users:
69
78
    try:
70
79
        # Get all subjects this user is enrolled in, and add them to the DB if
71
80
        # they match one of our local subject codes
72
 
        res = ivle.pulldown_subj.enrol_user(config, store, user)
 
81
        res = ivle.pulldown_subj.enrol_user(config, store, user, options.year)
73
82
        logging.info("Enrolled user %s in %d subject%s." % (user.login, res,
74
83
                        '' if res == 1 else 's'))
75
84
    except Exception, message: