def build_path(operation, ns):
"""
Build a path URI for an operation.
"""
try:
return ns.url_for(operation, _external=False)
except BuildError as error:
# we are missing some URI path parameters
uri_templates = {
argument: "{{{}}}".format(argument)
for argument in error.suggested.arguments
}
# flask will sometimes try to quote '{' and '}' characters
return unquote(ns.url_for(operation, _external=False, **uri_templates))
评论列表
文章目录