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

« back to all changes in this revision

Viewing changes to bin/ivle-addexercise

  • Committer: Matt Giuca
  • Date: 2009-04-23 07:51:29 UTC
  • Revision ID: matt.giuca@gmail.com-20090423075129-94mf4vlwllpew0xn
ivle.svn: Added revision_is_dir (like os.path.isdir for revision history).
ivle.fileservice_lib.listing: Refactored such that the SVN revision is found
    in the top-level handler, and passed down into the individual handlers.
    This is done so that the revision information can be used to make the
    decisions (which will be required to fix the revision history browsing).
    This doesn't yet change the behaviour.

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):
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: