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

« back to all changes in this revision

Viewing changes to bin/ivle-enrolallusers

  • Committer: David Coles
  • Date: 2009-11-27 05:34:33 UTC
  • mto: This revision was merged to the branch mainline in revision 1322.
  • Revision ID: coles.david@gmail.com-20091127053433-8ki9nm6xrkogxq67
Added diagram of system architecture

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
import optparse
35
35
import logging
36
36
 
 
37
import ivle.config
37
38
import ivle.database
38
39
import ivle.pulldown_subj
39
40
 
54
55
    print >> sys.stderr, "%s must be run as root" % sys.argv[0]
55
56
    sys.exit(1)
56
57
 
57
 
store = ivle.database.get_store()
 
58
config = ivle.config.Config()
 
59
store = ivle.database.get_store(config)
 
60
 
58
61
if options.user is None:
59
62
    users = store.find(ivle.database.User).order_by(ivle.database.User.login)
60
63
else:
75
78
    try:
76
79
        # Get all subjects this user is enrolled in, and add them to the DB if
77
80
        # they match one of our local subject codes
78
 
        res = ivle.pulldown_subj.enrol_user(store, user, options.year)
 
81
        res = ivle.pulldown_subj.enrol_user(config, store, user, options.year)
79
82
        logging.info("Enrolled user %s in %d subject%s." % (user.login, res,
80
83
                        '' if res == 1 else 's'))
81
84
    except Exception, message: