Skip to content

Commit 1ac713d

Browse files
telackeyalexellis
authored andcommitted
Implement proposal 716, pass full paths to functions
This changes the default route to be a wildcard, so that it will match any path forwarded by the Gateway and watchdog. Route-style as per Flask snippet 57: http://flask.pocoo.org/snippets/57/ Signed-off-by: Thomas E Lackey <[email protected]>
1 parent 3bf503e commit 1ac713d

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

template/python27-flask/index.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
app = Flask(__name__)
88

9-
@app.route("/", methods=["POST", "GET"])
9+
@app.route("/", defaults={"path": ""}, methods=["POST", "GET"])
10+
@app.route("/<path:path>", methods=["POST", "GET"])
1011
def main_route():
1112
ret = handler.handle(request.get_data())
1213
return ret

template/python3-flask-armhf/index.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
app = Flask(__name__)
1010

11-
@app.route("/", methods=["POST", "GET"])
11+
@app.route("/", defaults={"path": ""}, methods=["POST", "GET"])
12+
@app.route("/<path:path>", methods=["POST", "GET"])
1213
def main_route():
1314
ret = handler.handle(request.get_data())
1415
return ret

template/python3-flask/index.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
app = Flask(__name__)
1010

11-
@app.route("/", methods=["POST", "GET"])
11+
@app.route("/", defaults={"path": ""}, methods=["POST", "GET"])
12+
@app.route("/<path:path>", methods=["POST", "GET"])
1213
def main_route():
1314
ret = handler.handle(request.get_data())
1415
return ret

0 commit comments

Comments
 (0)