def post(self): status = self.request.get("status") handle = self.request.get("handle") signature = self.request.get("signature") check_param(self.response, "handle", handle) check_param(self.response, "signature", signature) check_signature(self.response, handle, signature) if status: image = find_image_by_handle(handle) image.put()
def get(self): handle = self.request.get("handle") signature = self.request.get("signature") check_param(self.response, "handle", handle) check_param(self.response, "signature", signature) check_signature(self.response, handle, signature) image = find_image_by_handle(handle) self.response.headers['Content-Type'] = 'application/json' response = { 'handle': image.handle, 'created_at': image.created_at.isoformat(), 'status': image.status } self.response.out.write(simplejson.dumps(response))
def get(self): handle = self.request.get("handle") signature = self.request.get("signature") check_param(self.response, "handle", handle) check_param(self.response, "signature", signature) check_signature(self.response, handle, signature) image = find_image_by_handle(handle) if image: blobstore.delete(image.blob_key.key()) response = { 'handle': handle, 'created_at': image.created_at.isoformat(), 'status': 'deleted' } image.delete() else: response = { 'handle': handle, 'status': 'not found' } self.response.headers['Content-Type'] = 'application/json' self.response.out.write(simplejson.dumps(response))
def get(self): handle = self.request.get("handle") signature = self.request.get("signature") upload_url = blobstore.create_upload_url('/image/submit') if check_param(self.response, "handle", handle) and \ check_param(self.response, "signature", signature) and \ check_signature(self.response, handle, signature): response = { 'handle': handle, 'signature': signature, 'post_to': upload_url } self.response.headers['Content-Type'] = 'application/json' self.response.out.write(simplejson.dumps(response))