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

« back to all changes in this revision

Viewing changes to bin/ivle-addexercise

  • Committer: William Grant
  • Date: 2009-04-28 05:06:00 UTC
  • Revision ID: grantw@unimelb.edu.au-20090428050600-hogd9d6wo7ksyqy8
ivle.database.get_store() now takes a configuration object.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
import os, sys, traceback
24
24
import xml.dom.minidom as minidom
25
25
 
 
26
from ivle.config import Config
26
27
from ivle.database import Exercise, TestSuite, TestCase, TestSuiteVar, TestCasePart, get_store
27
28
 
28
29
class XMLMalformedError(Exception):
175
176
xmlfile = sys.argv[1]
176
177
 
177
178
def add_exercise(xmlfile):
178
 
    store = get_store()
179
 
 
180
179
    # Skip existing ones.
181
180
    if store.find(Exercise, id=unicode(xmlfile)).count():
182
181
        return
239
238
 
240
239
    store.add(new_exercise)
241
240
    store.commit()
242
 
    
 
241
 
 
242
store = get_store(Config())
 
243
 
243
244
xmlfiles = sys.argv[1:]
244
245
for xmlfile in xmlfiles:
245
246
    try: