def post(self, uk): user_data = self.get_data() user_data['deviceid'] = "test-test-test" user = User() user.from_dict(user_data) user.generate_secret() user.generate_avatar_path() if user.save(): self.set_status(201) self.set_header('Location', user.get_link()) else: raise HTTPError(500, 'Save avatar user info error.') self.finish()
def post(self, phn): user = User() data = self.get_data() user.from_dict(data) # after the phone set in user.generate_avatar_path() if user.save(): self.set_status(201) self.set_header('Location', user.get_link()) msg = self.message("Created Success.") else: self.set_status(400) msg = self.message("name,phone,password field are required.") self.render_json(msg)