Example #1
0
 def get(self, petKeyUrlSafe):
     user = Authorization.isAuthenticated()
     if user:
         PetService.delete(petKeyUrlSafe)
         self.redirect('/clients')
     else:
         self.redirect('/')
Example #2
0
 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('/')
Example #3
0
 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("/")
Example #4
0
 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("/")
Example #5
0
 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('/')
Example #6
0
 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('/')