def post(self): if 'photo' in self.request.files: if not save_images(self.request.files['photo'], self.current_user): raise HTTPError(501, "save image error.") else: raise HTTPError(400, 'upload parameters dismatch') self.finish()
def post(self): if 'photo' in self.request.files: if save_images(self.request.files['photo']): msg = self.message("Upload Success.") else: self.set_status(501) msg = self.message("save photo fail.") else: self.set_status(400) msg = self.message("photo field is requierd.") self.render_json(msg)