def get(self, petKeyUrlSafe): user = Authorization.isAuthenticated() if user: PetService.delete(petKeyUrlSafe) self.redirect('/clients') else: self.redirect('/')
def post(self, clientKeyUrlSafe): user = Authorization.isAuthenticated() if user: try: PetService.addNew(clientKeyUrlSafe, self.request) except: logging.error("PetAddNew.py => post(self, clientKeyUrlSafe) => an exception was thrown trying to create a new Pet") finally: self.redirect('/clients') else: self.redirect('/')
def post(self, petKeyUrlSafe): user = Authorization.isAuthenticated() if user: try: PetService.update(petKeyUrlSafe, self.request) # petService = PetService(self.request) # petService.update(petName, clientPhone) except: logging.error( "PetEdit.py => post(self, phoneNumber) => an exception was thrown trying to create a new Pet" ) finally: self.redirect("/clients") else: self.redirect("/")
def get(self, petKeyUrlSafe): user = Authorization.isAuthenticated() if user: pet = PetService.get(petKeyUrlSafe) template_values = {"pet": pet, "buttonName": "Update", "postURL": "/petEdit/" + petKeyUrlSafe} template = JINJA_ENVIRONMENT.get_template("partials/petEditable.html") self.response.write(template.render(template_values)) else: self.redirect("/")
def get(self, petKeyUrlSafe): user = Authorization.isAuthenticated() if user: pet = PetService.get(petKeyUrlSafe) template_values = { 'pet':pet, } template = JINJA_ENVIRONMENT.get_template('partials/petReadOnly.html') self.response.write(template.render(template_values)) else: self.redirect('/')
def get(self): user = Authorization.isAuthenticated() if user: clients = ClientService.getAll() pets = PetService.getAll() template_values = { 'clients':clients, 'pets':pets, } template = JINJA_ENVIRONMENT.get_template('partials/clients.html') self.response.write(template.render(template_values)) else: self.redirect('/')