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

« back to all changes in this revision

Viewing changes to bin/ivle-addexercise

  • Committer: William Grant
  • Date: 2009-05-18 12:13:44 UTC
  • Revision ID: grantw@unimelb.edu.au-20090518121344-m69gxcfqwoeirtru
Fix make_path_segments' docstring.

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):
61
62
    cases = []
62
63
    case_num = 0
63
64
    for case_node in suite_node.getElementsByTagName('function'):
 
65
        cases.append(add_test_case(case_node, case_num, store))
64
66
        case_num += 1
65
 
        cases.append(add_test_case(case_node, case_num, store))
66
67
 
67
68
    ## ALLOWED TAGS ##
68
69
    # stdin     - Stdin for the suite - Unique - Text inside element
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: