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

« back to all changes in this revision

Viewing changes to bin/ivle-listusers

  • Committer: Matt Giuca
  • Date: 2010-07-22 02:12:36 UTC
  • mfrom: (1812.1.13 late-submit)
  • Revision ID: matt.giuca@gmail.com-20100722021236-k8kt4cqdtywzpk24
Merge from trunk late-submit.
Students may now submit projects after the deadline, but they are warned that the submission is late.
Lecturers are now given data on which submissions were made late, and how many days.
(LP: #598346)

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
import os
28
28
import getopt
29
29
 
30
 
import ivle.db
 
30
import ivle.config
 
31
import ivle.database
31
32
 
32
33
# Options processing
33
34
def usage():
56
57
    print "Must run listusers.py as root."
57
58
    sys.exit()
58
59
 
59
 
try:
60
 
    db = ivle.db.DB()
61
 
    list = db.get_users()
62
 
except Exception, message:
63
 
    print "Error: " + str(message)
64
 
    sys.exit(1)
 
60
store = ivle.database.get_store(ivle.config.Config())
 
61
users = store.find(ivle.database.User).order_by(ivle.database.User.login)
65
62
 
66
 
list.sort(key=lambda user: user.login)
67
 
for user in list:
 
63
for user in users:
68
64
    if justnames:
69
65
        print user.login
70
66
    else: