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

« back to all changes in this revision

Viewing changes to ivle/worksheet/utils.py

  • Committer: William Grant
  • Date: 2010-07-28 05:06:15 UTC
  • Revision ID: grantw@unimelb.edu.au-20100728050615-uwbxn9frla3pdw8m
Encode content_type when downloading files. cjson made us write bad code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
258
258
    exercises = []
259
259
    # Turns the worksheet into an xml stream, and then finds all the 
260
260
    # exercise nodes in the stream.
261
 
    worksheetdata = genshi.XML(worksheet.get_xml())
 
261
    worksheetdata = genshi.XML(worksheet.data_xhtml)
262
262
    for kind, data, pos in worksheetdata:
263
263
        if kind is genshi.core.START:
264
264
            # Data is a tuple of tag name and a list of name->value tuples
308
308
    jail_path = os.path.join(config['paths']['jails']['mounts'],
309
309
                             user.login)
310
310
    working_dir = os.path.join("/home", user.login)
311
 
    cons = ivle.console.Console(config, user.unixid, jail_path,
 
311
    cons = ivle.console.Console(config, user, jail_path,
312
312
                                working_dir)
313
313
 
314
314
    # Parse the file into a exercise object using the test suite
346
346
 
347
347
 
348
348
# XXX: This really shouldn't be needed.
349
 
def create_list_of_fake_worksheets_and_stats(config, store, user, offering):
 
349
def create_list_of_fake_worksheets_and_stats(config, store, user, offering,
 
350
    as_of=None):
350
351
    """Take an offering's real worksheets, converting them into stats.
351
352
 
352
353
    The worksheet listing views expect special fake worksheet objects
373
374
        if new_worksheet.assessable:
374
375
            # Calculate the user's score for this worksheet
375
376
            mand_done, mand_total, opt_done, opt_total = (
376
 
                ivle.worksheet.utils.calculate_score(store, user, worksheet))
 
377
                ivle.worksheet.utils.calculate_score(store, user, worksheet,
 
378
                                                     as_of=as_of))
377
379
            if opt_total > 0:
378
380
                optional_message = " (excluding optional exercises)"
379
381
            else: