def get(self): overdueGear = [g for g in Gear.all() if g.returnDate and datetime.now() > g.returnDate] for g in overdueGear: sender_address = '*****@*****.**' destination_address = [g.holder.email, '*****@*****.**', '*****@*****.**', '*****@*****.**'] subject = 'Overdue Gear' body = "You have a piece of gear that is overdue, " + g.number + ". Please return it at the next meeting. If you can't make it please email one of the gear czars to find a time.""" mail.send_mail(sender_address, destination_address, subject, body)
def post(self): #Get information from the post request gearNum = self.request.get("number") if not (gearNum[1:].isdigit() and gearNum[0].isalpha): self.write_form(error = "Please put in a letter and number") return description = self.request.get("description") password = self.request.get('password') # if password != constants.PASSWORD: # self.write_form(error = "Wrong password!") # return itemQuery = db.GqlQuery("SELECT * FROM Gear WHERE number = :1", gearNum) if itemQuery.count() == 0: item = Gear(number=gearNum, description=description) item.put() self.redirect("/addGear") else: self.write_form(error = "The item number is taken")
def post(self): #Get information from the post request gearNum = self.request.get("number") if not (gearNum[1:].isdigit() and gearNum[0].isalpha): self.write_form(error="Please put in a letter and number") return description = self.request.get("description") password = self.request.get('password') # if password != constants.PASSWORD: # self.write_form(error = "Wrong password!") # return itemQuery = db.GqlQuery("SELECT * FROM Gear WHERE number = :1", gearNum) if itemQuery.count() == 0: item = Gear(number=gearNum, description=description) item.put() self.redirect("/addGear") else: self.write_form(error="The item number is taken")