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

« back to all changes in this revision

Viewing changes to bin/ivle-addexercise

  • 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:
23
23
import os, sys, traceback
24
24
import xml.dom.minidom as minidom
25
25
 
26
 
from ivle.config import Config
27
26
from ivle.database import Exercise, TestSuite, TestCase, TestSuiteVar, TestCasePart, get_store
28
27
 
29
28
class XMLMalformedError(Exception):
62
61
    cases = []
63
62
    case_num = 0
64
63
    for case_node in suite_node.getElementsByTagName('function'):
 
64
        case_num += 1
65
65
        cases.append(add_test_case(case_node, case_num, store))
66
 
        case_num += 1
67
66
 
68
67
    ## ALLOWED TAGS ##
69
68
    # stdin     - Stdin for the suite - Unique - Text inside element
176
175
xmlfile = sys.argv[1]
177
176
 
178
177
def add_exercise(xmlfile):
 
178
    store = get_store()
 
179
 
179
180
    # Skip existing ones.
180
181
    if store.find(Exercise, id=unicode(xmlfile)).count():
181
182
        return
238
239
 
239
240
    store.add(new_exercise)
240
241
    store.commit()
241
 
 
242
 
store = get_store(Config())
243
 
 
 
242
    
244
243
xmlfiles = sys.argv[1:]
245
244
for xmlfile in xmlfiles:
246
245
    try: