def _make_response(form, include_user=True, include_auth_token=False): has_errors = len(form.errors) > 0 if has_errors: api.abort(400, message=form.errors) else: response = dict() if include_user: response['user_id'] = form.user.id if include_auth_token: token = form.user.get_auth_token() response['authentication_token'] = token return response
def _make_response(form, include_user=True, include_auth_token=False): has_errors = len(form.errors) > 0 if has_errors: api.abort(400, message=form.errors) else: response = dict() if include_user: response["user_id"] = form.user.id if include_auth_token: token = form.user.get_auth_token() response["authentication_token"] = token return response
def get(self, id): posts = Post.query.filter_by(id=id).first() if not posts: api.abort(404) return posts