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

« back to all changes in this revision

Viewing changes to bin/ivle-cloneworksheets

  • Committer: William Grant
  • Date: 2009-02-26 02:08:28 UTC
  • Revision ID: grantw@unimelb.edu.au-20090226020828-0qrhe3llq9r5olmr
ivle-showenrolment: Swap year and semester, and show the role.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import os
22
22
import sys
23
23
 
24
 
import ivle.config
25
24
from ivle.database import get_store, Subject, Semester, Offering, Worksheet
26
 
import ivle.worksheet.utils
 
25
import ivle.worksheet
27
26
 
28
27
def die(error):
29
28
    print >> sys.stderr, '%s: %s' % (os.path.basename(sys.argv[0]), error)
35
34
                         % os.path.basename(sys.argv[0])
36
35
    sys.exit()
37
36
 
38
 
store = get_store(ivle.config.Config())
 
37
store = get_store()
39
38
 
40
39
src = store.find(Offering,
41
40
                 Subject.code == unicode(sys.argv[1]),
64
63
    newws.format = oldws.format
65
64
    newws.offering = dst
66
65
    store.add(newws)
67
 
    ivle.worksheet.utils.update_exerciselist(newws)
 
66
    ivle.worksheet.update_exerciselist(newws)
68
67
 
69
68
print >> sys.stderr, 'copied %d worksheets from %r to %r' \
70
69
                     % (dst.worksheets.count(), src, dst)