~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 10:28:15 UTC
  • mto: This revision was merged to the branch mainline in revision 1196.
  • Revision ID: matt.giuca@gmail.com-20090424102815-x0h6l7r08vue9my8
ivle.database: Added Subject.active_offerings, which can be used by tools
    (such as ivle-marks) to get the active offerings of a subject.

Show diffs side-by-side

added added

removed removed

Lines of Context:
256
256
                perms.add('edit')
257
257
        return perms
258
258
 
 
259
    def active_offerings(self):
 
260
        """Return a sequence of currently active offerings for this subject
 
261
        (offerings whose semester.state is "current"). There should be 0 or 1
 
262
        elements in this sequence, but it's possible there are more.
 
263
        """
 
264
        return self.offerings.find(Offering.semester_id == Semester.id
 
265
                                   and Semester.state == u'current')
 
266
 
259
267
class Semester(Storm):
260
268
    __storm_table__ = "semester"
261
269