def status(code):
def response(*args, **kwargs):
if args and kwargs:
raise TypeError("Cannot pass both args and kwargs.")
elif len(args) == 1:
data = args[0]
else:
data = args or kwargs
if data:
data = (json.dumps(data), '\n')
else:
data = None
return current_app.response_class(
response=data,
status=code,
mimetype=current_app.config['JSONIFY_MIMETYPE']
)
return response
评论列表
文章目录