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

« back to all changes in this revision

Viewing changes to www/apps/tutorial/__init__.py

  • Committer: Matt Giuca
  • Date: 2009-01-19 11:22:31 UTC
  • mto: This revision was merged to the branch mainline in revision 1090.
  • Revision ID: matt.giuca@gmail.com-20090119112231-b2ypzkp4viip6qsk
tutorial: Simplified update_db_worksheet. Now expects a list of pairs, rather
    than being more lenient (no callers rely on the additional leniency).

Show diffs side-by-side

added added

removed removed

Lines of Context:
661
661
 
662
662
    if updated_database and exercise_list is not None:
663
663
        # Insert each exercise into the worksheet
664
 
        for exercise_tuple in exercise_list:
665
 
            if isinstance(exercise_tuple, tuple):
666
 
                exercise_name = exercise_tuple[0]
667
 
                try:
668
 
                    optional = exercise_tuple[1]
669
 
                except IndexError:
670
 
                    optional = False
671
 
            else:
672
 
                exercise_name = exercise_tuple
673
 
                optional = False
 
664
        for exercise_name, optional in exercise_list:
674
665
            # Get the Exercise from the DB
675
 
            # XXX What if this fails?
676
666
            exercise = ivle.database.Exercise.get_by_name(store,exercise_name)
677
667
            # Create a new binding between the worksheet and the exercise
678
668
            worksheetexercise = ivle.database.WorksheetExercise(