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

« back to all changes in this revision

Viewing changes to bin/ivle-enrolallusers

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:
34
34
import optparse
35
35
import logging
36
36
 
37
 
import ivle.db
38
37
import ivle.database
39
38
import ivle.pulldown_subj
40
39
 
70
69
    logging.error("Year must be numeric")
71
70
    sys.exit(1)
72
71
 
 
72
options.year = unicode(options.year)
 
73
 
73
74
for user in users:
74
75
    try:
75
76
        # Get all subjects this user is enrolled in, and add them to the DB if
76
77
        # they match one of our local subject codes
77
 
        res = ivle.pulldown_subj.enrol_user(user.login, options.year)
 
78
        res = ivle.pulldown_subj.enrol_user(store, user, options.year)
78
79
        logging.info("Enrolled user %s in %d subject%s." % (user.login, res,
79
80
                        '' if res == 1 else 's'))
80
81
    except Exception, message:
81
82
        logging.warning(str(message))
82
83
        continue
83
84
    
 
85
store.commit()
84
86
logging.info("enrolment completed successfully")