Skip to content
Myr

Merge pull request #3129 from adamchainz/fix_html_injection

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix some HTML injection paths in examples

authored by David Lord · committed by GitHub · parents eadb99e, e5b0fe6 · Browse files · 1 file+4 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−4 removed

  • other:+4 added−4 removed

1 file+4 added−4 removed

modified:docs/quickstart.rst+4 added-4 removed
201 unmodified lines
202203 @app.route('/user/<username>')204 def show_user_profile(username):205 # show the user profile for that user206 return 'User %s' % username206 return 'User %s' % escape(username)207208 @app.route('/post/<int:post_id>')209 def show_post(post_id):210 # show the post with the given id, the id is an integer
1 unmodified line
212213 @app.route('/path/<path:subpath>')214 def show_subpath(subpath):215 # show the subpath after /path/216 return 'Subpath %s' % subpath216 return 'Subpath %s' % escape(subpath)217218Converter types:219220========== ==========================================
57 unmodified lines
278to try out :func:`~flask.url_for`. :meth:`~flask.Flask.test_request_context`279tells Flask to behave as though it's handling a request even while we use a280Python shell. See :ref:`context-locals`. ::281282 from flask import Flask, url_for282 from flask import Flask, escape, url_for283284 app = Flask(__name__)285286 @app.route('/')
5 unmodified lines
292 return 'login'293294 @app.route('/user/<username>')295 def profile(username):296 return '{}\'s profile'.format(username)296 return '{}\'s profile'.format(escape(username))297298 with app.test_request_context():299 print(url_for('index'))300 print(url_for('login'))
551 unmodified lines