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

« back to all changes in this revision

Viewing changes to bin/ivle-enrolallusers

  • Committer: Matt Giuca
  • Date: 2009-12-01 04:27:58 UTC
  • mfrom: (1164.2.46 sphinx-docs)
  • Revision ID: matt.giuca@gmail.com-20091201042758-wuxd9bdec00c283i
Merged sphinx-docs branch. This adds Sphinx documentation for the entire IVLE system (for system administrators and developers), and removes all of our random old document files (all either irrelevant, or moved into the Sphinx docs nicely). Currently incomplete, but ready to merge.

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: