def post(self): print("DelConfirmHandler") courtlist = [] try: keylist = self.request.get_all('keys') print("get keys") for key in keylist: print(key) p = db.get(key) #Get the court by its unique key (key) print("db.get(key)") continue c = Courts() c.date = library.cday(p.start) c.weekday = p.weekday c.start = library.ctime(p.start) c.end = library.ctime(p.end) c.desc = p.desc c.courts = library.listconv(p.courts) c.location = library.location(p.location) c.key = key courtlist.append(c) except Exception as e: print "EXCEPTION: " + str(e) # weekday, date, courts,location,start,desc template_values = {"CourtList": courtlist}
def post(self): print("DelCourtConfirmHandler") courtlist = [] try: keylist = self.request.get_all('keys') print("get keys") for key in keylist: c = Courts() # c.key = key # p = db.get(key) #Get the court by its unique key (key) print("db.get(key)") c.date = library.cday(p.start) c.weekday = p.weekday c.start = library.ctime(p.start) c.end = library.ctime(p.end) c.desc = p.desc c.courts = library.listconv(p.courts) c.location = library.location(p.location) c.key = key courtlist.append(c) print key except: print "EXCEPTION" # weekday, date, courts,location,start,desc template_values = {"CourtList": courtlist} path = os.path.join(os.path.dirname(__file__), 'templates', 'delcourtconfirm.html') self.response.out.write(template.render(path, template_values))
def get(self): print("get") query = "select __key__ from CourtTime order by date" keys = db.GqlQuery(query) courtlist = [] for k in keys: p = db.get(k) c = Courts() c.weekday = p.weekday c.date = library.cday(p.date) c.start = library.ctime(p.start) c.end = library.ctime(p.end) c.courts = library.listconv(p.courts) c.location = library.location(p.location) c.desc = p.desc c.key = k courtlist.append(c) print(c.date) template_values = {'CourtList': courtlist} path = os.path.join(os.path.dirname(__file__), 'templates', 'all.html') self.response.out.write(template.render(path, template_values))
def get(self, month, day, year): LoggedIn = False User = Team = "" path = os.environ['PATH_INFO'] if (self.session.get('user')): # (NEWSESSION) LoggedIn = True User = self.session['fname'] + " " + self.session['lname'] Team = " (" + self.session['team'] + ")" d = "DATETIME(" + year + "," + month + "," + day + ")" query = "select __key__ from CourtTime where date= " + d keys = db.GqlQuery(query) available = False courtlist = [] for k in keys: p = db.get(k) # c = Court_old( p.weekday,p.courts, p.start, p.end, p.desc , k ) # DONE REFACTORed to Court c = Court() c.day = library.cday(p.start) c.start = library.ctime(p.start) c.end = library.ctime(p.end) c.desc = p.desc c.key = k c.courts = library.listconv(p.courts) c.location = library.location(p.location) c.open = True if (type(p.owner) is not types.NoneType): g = datastore.Captain.get_by_key_name(p.owner) c.owner = g.fname c.open = False courtlist.append(c) if (c.open == True): available = True template_values = { 'month': month, 'day': day, 'year': year, 'LoggedIn': LoggedIn, 'User': User, 'Team': Team, 'path': path, 'Courtlist': courtlist, 'Available': available } path = os.path.join(os.path.dirname(__file__), 'templates', 'courts.html') self.response.out.write(template.render(path, template_values))
def get(self, month, day, year): pass d = "DATETIME(" + year + "," + month + "," + day + ")" query = "select __key__ from CourtTime where date= " + d keys = db.GqlQuery(query) courtlist = [] for k in keys: p = db.get(k) c = Courts() c.day = library.cday(p.start) c.start = library.ctime(p.start) c.end = library.ctime(p.end) c.desc = p.desc c.key = k c.courts = library.listconv(p.courts) c.location = library.location(p.location) c.open = True if (type(p.owner) is not types.NoneType): g = datastore.Captain.get_by_key_name(p.owner) c.owner = g.fname c.open = False courtlist.append(c) template_values = { 'month': month, 'day': day, 'year': year, 'Courtlist': courtlist, 'LoginForm': library.LoginForm(), # 'Site' : library.Host() + "/reserve", # 'Key' : k } path = os.path.join(os.path.dirname(__file__), 'delcourts.html') self.response.out.write(template.render(path, template_values))
def get(self): capt_keyname = "" LoggedIn = False User = Team = "" path = os.environ['PATH_INFO'] CaptainReservation = Reservation() if (self.session.get('user')): LoggedIn = True User = self.session['fname'] + " " + self.session['lname'] Team = " (" + self.session['team'] + ")" capt_keyname = self.session['keyname'] CaptainReservation.fname = self.session['fname'] CaptainReservation.lname = self.session['lname'] CaptainReservation.team = self.session['team'] # TODO more efficient db grab query = "select __key__ from CourtTime where owner='" + capt_keyname + "'" keys = db.GqlQuery(query) res = db.get(keys) courtlist = [] for r in res: c = Court() c.weekday = r.weekday c.date = library.cday(r.date) c.start = library.ctime(r.start) c.end = library.ctime(r.end) c.courts = library.listconv(r.courts) # loc="LP" # if( re.search("Mg",r.location,re.IGNORECASE)): loc="Mango" c.location = library.location(r.location) courtlist.append(c) CaptainReservation.courts = courtlist # --------------------------------------------------------------------------------- query = "select __key__ from CourtTime order by date" keys = db.GqlQuery(query) Mango = [] Courts = [] for k in keys: r = db.get(k) if (type(r.owner) is not types.NoneType): c = Court() c.weekday = r.weekday c.date = library.cday(r.date) c.start = library.ctime(r.start) c.end = library.ctime(r.end) c.courts = library.listconv(r.courts) g = datastore.Captain.get_by_key_name(r.owner) c.captain = g.fname + " " + g.lname c.team = g.team c.location = library.location(r.location) print("location: " + c.location) if (c.location is not types.NoneType): Courts.append(c) # --------------------------------------------------------------------------------- template_values = { 'LoggedIn': LoggedIn, 'User': User, 'Team': Team, 'path': path, 'CaptainReservation': CaptainReservation, # 'Mango': Mango, 'Courts': Courts # 'OtherTeams': OtherTeams } path = os.path.join(os.path.dirname(__file__), 'templates', 'summary.html') self.response.out.write(template.render(path, template_values))
def get(self): capt_keyname = "" # SESSION LoggedIn = False User = Team = "" path = os.environ['PATH_INFO'] if (self.session.get('user')): # (NEWSESSION) LoggedIn = True User = self.session['fname'] + " " + self.session['lname'] Team = " (" + self.session['team'] + ")" # SESSION # Get the list of captains query = "select __key__ from Captain order by team" keys = db.GqlQuery(query) res = db.get(keys) CaptainList = [] for r in res: c = Captain() c.fname = r.fname c.lname = r.lname c.user = r.user c.team = r.team CaptainList.append(c) # CaptainReservation = Reservation() user = self.session.get('user') #Captain name (that's all we need) if (user != None): LoggedIn = True capt_keyname = self.session['keyname'] CaptainReservation.fname = self.session['fname'] CaptainReservation.lname = self.session['lname'] CaptainReservation.team = self.session['team'] g = datastore.Captain.get_by_key_name(capt_keyname) CaptainReservation.count = g.count # TODO more efficient db grab query = "select __key__ from CourtTime where owner='" + capt_keyname + "'" + " order by date " keys = db.GqlQuery(query) res = db.get(keys) courtlist = [] for r in res: c = Court() c.weekday = r.weekday c.date = library.cday(r.date) c.start = library.ctime(r.start) c.end = library.ctime(r.end) c.courts = library.listconv(r.courts) c.location = library.location(r.location) c.desc = r.desc c.key = r.key().name() courtlist.append(c) CaptainReservation.courts = courtlist # --------------------------------------------------------------------------------- template_values = { 'Host': "/", 'LoggedIn': LoggedIn, 'User': User, 'Team': Team, 'path': path, 'CaptainList': CaptainList, 'CaptainReservation': CaptainReservation, 'Site': library.Host() + "/unreserve", } path = os.path.join(os.path.dirname(__file__), 'templates', 'captain.html') self.response.out.write(template.render(path, template_values))