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

« back to all changes in this revision

Viewing changes to bin/ivle-marks

  • Committer: Matt Giuca
  • Date: 2009-04-24 12:56:05 UTC
  • mto: This revision was merged to the branch mainline in revision 1196.
  • Revision ID: matt.giuca@gmail.com-20090424125605-fykddz9xih2i7orh
ivle-marks: Added code to get an offering from the DB (either the semester
    specified, or the current active semester).

Show diffs side-by-side

added added

removed removed

Lines of Context:
174
174
        print >>sys.stderr, "No subject with short name '%s'" % subject_name
175
175
        return 1
176
176
 
 
177
    # Get the offering from the DB
 
178
    if semester is None:
 
179
        # None specified - get the current offering from the DB
 
180
        offerings = list(subject.active_offerings())
 
181
        if len(offerings) == 0:
 
182
            print >>sys.stderr, ("No active offering for subject '%s'"
 
183
                                 % subject_name)
 
184
            return 1
 
185
        elif len(offerings) > 1:
 
186
            print >>sys.stderr, ("Multiple active offerings for subject '%s':"
 
187
                                 % subject_name)
 
188
            print >>sys.stderr, "Please use one of:"
 
189
            for offering in offerings:
 
190
                print >>sys.stderr, ("    --semester=%s/%s"
 
191
                    % (offering.semester.year, offering.semester.semester))
 
192
            return 1
 
193
        else:
 
194
            offering = offerings[0]
 
195
    else:
 
196
        # Get the offering for the specified semester
 
197
        offering = subject.offering_for_semester(year, semester)
 
198
        if offering is None:
 
199
            print >>sys.stderr, (
 
200
                "No offering for subject '%s' in semester %s/%s"
 
201
                % (subject_name, year, semester))
 
202
            return 1
 
203
 
 
204
    # TEMP (since the code below is going to fail)
 
205
    print "Offering = %r" % offering
 
206
    return
 
207
 
177
208
    # Get the list of assessable worksheets from the subject.xml file.
178
209
    worksheets = get_assessable_worksheets(subject_name)
179
210