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

« back to all changes in this revision

Viewing changes to lib/common/db.py

  • Committer: dcoles
  • Date: 2008-08-07 04:12:57 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:986
Groups: Added userservice/create_group call. You can now create a project in 
the database if you have CAP_MANAGEGROUPS. Will also create a svn_repository in 
the groups namespace (note, we only have flat directory structure since 
apache's svn module doen't traverse paths...)

Show diffs side-by-side

added added

removed removed

Lines of Context:
975
975
                for groupid, groupnm, nick, ismember
976
976
                in self.db.query(query).getresult()]
977
977
 
 
978
    def get_offering_info(self, projectsetid, dry=False):
 
979
        """Takes information from projectset and returns useful information 
 
980
        about the subject and semester. Returns as a dictionary.
 
981
        """
 
982
        query = """\
 
983
SELECT subjectid, subj_code, subj_name, subj_short_name, url, year, semester, 
 
984
active
 
985
FROM subject, offering, semester, project_set
 
986
WHERE offering.subject = subject.subjectid AND
 
987
    offering.semesterid = semester.semesterid AND
 
988
    project_set.offeringid = offering.offeringid AND
 
989
    project_set.projectsetid = %d;"""%projectsetid
 
990
        if dry:
 
991
            return query
 
992
        return self.db.query(query).dictresult()[0]      
 
993
 
978
994
    def close(self):
979
995
        """Close the DB connection. Do not call any other functions after
980
996
        this. (The behaviour of doing so is undefined).