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

« back to all changes in this revision

Viewing changes to ivle/database.py

  • Committer: William Grant
  • Date: 2009-02-27 04:33:45 UTC
  • Revision ID: grantw@unimelb.edu.au-20090227043345-5wr2c6sta4hatonn
Add Offering.unenrol(), to unenrol a user from an offering.

Show diffs side-by-side

added added

removed removed

Lines of Context:
287
287
        enrolment.active = True
288
288
        enrolment.role = role
289
289
 
 
290
    def unenrol(self, user):
 
291
        '''Unenrol a user from this offering.'''
 
292
        enrolment = Store.of(self).find(Enrolment,
 
293
                               Enrolment.user_id == user.id,
 
294
                               Enrolment.offering_id == self.id).one()
 
295
        Store.of(enrolment).remove(enrolment)
 
296
 
290
297
    def get_permissions(self, user):
291
298
        perms = set()
292
299
        if user is not None: