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

« back to all changes in this revision

Viewing changes to ivle/db.py

  • Committer: William Grant
  • Date: 2009-01-20 02:58:01 UTC
  • mto: This revision was merged to the branch mainline in revision 1090.
  • Revision ID: grantw@unimelb.edu.au-20090120025801-etj02h3l0uo9dguw
www/apps/userservice: Use Storm rather than get_offering_semesters.
    Also remove a few unneeded DB opens.
ivle.db.get_offering_semesters: Remove. Unused.

Show diffs side-by-side

added added

removed removed

Lines of Context:
412
412
                frozenset(['date', 'text']),
413
413
                frozenset(['problemid', 'loginid']))
414
414
 
415
 
    # SUBJECTS AND ENROLEMENT
416
 
 
417
 
    def get_offering_semesters(self, subjectid, dry=False):
418
 
        """
419
 
        Get the semester information for a subject as well as providing 
420
 
        information about if the subject is active and which semester it is in.
421
 
        """
422
 
        query = """\
423
 
SELECT offeringid, subj_name, year, semester, active
424
 
FROM semester, offering, subject
425
 
WHERE offering.semesterid = semester.semesterid AND
426
 
    offering.subject = subject.subjectid AND
427
 
    offering.subject = %d;"""%subjectid
428
 
        if dry:
429
 
            return query
430
 
        results = self.db.query(query).dictresult()
431
 
        # Parse boolean varibles
432
 
        for result in results:
433
 
            result['active'] = _parse_boolean(result['active'])
434
 
        return results
435
 
 
436
415
    def close(self):
437
416
        """Close the DB connection. Do not call any other functions after
438
417
        this. (The behaviour of doing so is undefined).