Added docstrings
This commit is contained in:
parent
c8458dabcb
commit
1205fa459c
11
app.py
11
app.py
|
@ -22,9 +22,10 @@ def root_view():
|
||||||
for rule in sorted(app.url_map.iter_rules(), key=lambda rule: rule.rule):
|
for rule in sorted(app.url_map.iter_rules(), key=lambda rule: rule.rule):
|
||||||
if rule.endpoint != "static":
|
if rule.endpoint != "static":
|
||||||
# Get only the first line from the docstring as the summary
|
# Get only the first line from the docstring as the summary
|
||||||
routes[rule.rule] = list(
|
if app.view_functions[rule.endpoint].__doc__:
|
||||||
filter(None, app.view_functions[rule.endpoint].__doc__.split("\n"))
|
routes[rule.rule] = list(
|
||||||
)[0].strip()
|
filter(None, app.view_functions[rule.endpoint].__doc__.split("\n"))
|
||||||
|
)[0].strip()
|
||||||
|
|
||||||
# HTML response
|
# HTML response
|
||||||
if request.accept_mimetypes.accept_html:
|
if request.accept_mimetypes.accept_html:
|
||||||
|
@ -161,6 +162,9 @@ def request_view():
|
||||||
|
|
||||||
@app.route("/samesite")
|
@app.route("/samesite")
|
||||||
def samesite_view():
|
def samesite_view():
|
||||||
|
"""
|
||||||
|
Test the SameSite Haproxy bug (BZ#1879445)
|
||||||
|
"""
|
||||||
hostname = os.environ.get("HOSTNAME")
|
hostname = os.environ.get("HOSTNAME")
|
||||||
return f"""
|
return f"""
|
||||||
<html>
|
<html>
|
||||||
|
@ -169,6 +173,7 @@ def samesite_view():
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
SameSite on {hostname} <br />
|
SameSite on {hostname} <br />
|
||||||
|
Both hostnames shown here should be the same if session stickiness is working properly with haproxy. <br />:w
|
||||||
<iframe src=\"/samesite/iframe\" title=\"samesite test\">
|
<iframe src=\"/samesite/iframe\" title=\"samesite test\">
|
||||||
</body>
|
</body>
|
||||||
</html>"""
|
</html>"""
|
||||||
|
|
Loading…
Reference in New Issue