Пример #1
0
 def get(self):
   logging.info("Just attempted a GET for Image")
   greeting = Greeting.get_by_key_name(self.request.get("name"))
   if greeting.avatar:
     logging.info("Got file from DB and Sending")
     self.response.headers['Content-Type'] = "image/png"
     self.response.out.write(greeting.avatar)
   else:
     logging.info("Error in fetching image")
     self.error(404)
Пример #2
0
 def post(self):
   logging.info("Just attempted to upload Image")
   avatar = self.request.get("uploaded")
   greeting = Greeting(key_name = str(self.request.get("name")),
   avatar = db.Blob(avatar))
   greeting.put()