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

« back to all changes in this revision

Viewing changes to bin/ivle-remakeuser

  • Committer: William Grant
  • Date: 2010-07-27 10:25:59 UTC
  • Revision ID: grantw@unimelb.edu.au-20100727102559-cvt3fhlaiaknd5bp
Validate uniqueness of Subject.code at the form layer, so we don't crash due to DB constraints.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
import os
29
29
import optparse
30
30
import logging
 
31
import traceback
31
32
 
 
33
import ivle.config
32
34
import ivle.database
33
35
import ivle.makeuser
34
36
 
48
50
                          os.path.basename(sys.argv[0])
49
51
    sys.exit(1)
50
52
 
51
 
store = ivle.database.get_store()
 
53
config = ivle.config.Config()
 
54
store = ivle.database.get_store(config)
52
55
 
53
56
if options.all:
54
57
    users = store.find(ivle.database.User).order_by(ivle.database.User.login)
62
65
 
63
66
for user in users:
64
67
    try:
65
 
        ivle.makeuser.make_jail(user)
 
68
        ivle.makeuser.make_jail(user, config)
66
69
    except Exception, message:
67
 
        logging.warning(str(message))
 
70
        logging.error("Failed to recreate jail for %s.\n%s" % 
 
71
                      (user.login, traceback.format_exc()))
68
72
        continue
69
73
 
70
74
    logging.debug("recreated user %s's jail." % user.login)