def getAvailable(self, first, next, classType): available = {} unavailable = self.getUnavailableStatus(classType) query = 'SELECT * FROM getavailable(?, ?, ?, ?)' cursor = self._conn.cursor() cursor.execute(query, first, next, classType, unavailable) for row in cursor: day = row.day.toordinal() if not available.has_key(day): available[day] = {} if row.status != unavailable: if not available[day].has_key(row.status): available[day][row.status] = [] userInfo = user(row) #TODO: don't duplicate storage of this available[day][row.status].append(userInfo) assigned = row.assigned if assigned == None: assigned = 0 else: assigned = int(row.assigned) if assigned: #treat assigned as a pseudo status if not available[day].has_key("assigned"): available[day]["assigned"] = [] userInfo = user(row) #TODO: don't duplicate storage of this available[day]["assigned"].append(userInfo) cursor.close() return available
def getUser(self, username): userInfo = None query = 'SELECT * FROM getuser(?)' cursor = self._conn.cursor() cursor.execute(query, username) row = cursor.fetchone() if row != None: userInfo = user(row) cursor.close() return userInfo
import sum2 import utility import requests print "hello world", utility.user() print sum2.sum(1, 1)
import sum2 import utility import requests print "hello world", utility.user() print sum2.sum(1,1)