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

« back to all changes in this revision

Viewing changes to bin/ivle-addexercise

  • Committer: Matt Giuca
  • Date: 2009-02-24 04:44:00 UTC
  • mto: This revision was merged to the branch mainline in revision 1119.
  • Revision ID: matt.giuca@gmail.com-20090224044400-m9mm2ngpt2d2jyv0
title.svg: Changed background colour to blue (for testing purposes)
    - this is the same as the actual background of the site.
    And moved the letters "IVLE" so they are evenly distributed, and appear
    behind the words they stand for.

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: