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

« back to all changes in this revision

Viewing changes to bin/ivle-cloneworksheets

  • Committer: William Grant
  • Date: 2009-04-28 08:17:26 UTC
  • Revision ID: grantw@unimelb.edu.au-20090428081726-7h8fyjclxtydjma0
No more ivle.conf in ivle.webapp.fileservice...

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