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

« back to all changes in this revision

Viewing changes to bin/ivle-addexercise

  • Committer: Matt Giuca
  • Date: 2009-05-19 02:54:08 UTC
  • mfrom: (1258 trunk)
  • mto: This revision was merged to the branch mainline in revision 1322.
  • Revision ID: matt.giuca@gmail.com-20090519025408-19c7cjl7w6ot6frm
MergedĀ fromĀ trunk.

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: