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

« back to all changes in this revision

Viewing changes to ivle/database.py

  • Committer: Matt Giuca
  • Date: 2009-04-24 12:43:55 UTC
  • mto: This revision was merged to the branch mainline in revision 1196.
  • Revision ID: matt.giuca@gmail.com-20090424124355-e4dcc9v10qo54ihl
ivle.database: Added Subject.offering_for_semester.

Show diffs side-by-side

added added

removed removed

Lines of Context:
261
261
        (offerings whose semester.state is "current"). There should be 0 or 1
262
262
        elements in this sequence, but it's possible there are more.
263
263
        """
264
 
        return self.offerings.find(Offering.semester_id == Semester.id
265
 
                                   and Semester.state == u'current')
 
264
        return self.offerings.find(Offering.semester_id == Semester.id,
 
265
                                   Semester.state == u'current')
 
266
 
 
267
    def offering_for_semester(self, year, semester):
 
268
        """Get the offering for the given year/semester, or None."""
 
269
        return self.offerings.find(Offering.semester_id == Semester.id,
 
270
                               Semester.year == unicode(year),
 
271
                               Semester.semester == unicode(semester)).one()
266
272
 
267
273
class Semester(Storm):
268
274
    __storm_table__ = "semester"