From b80eaf2c9978c776c9efbb267ccbfdee875d0966 Mon Sep 17 00:00:00 2001 From: Isaac To Date: Thu, 6 Feb 2020 12:14:10 -0800 Subject: [PATCH 1/2] Incorrect grammar The original sentence has incorrect grammar --- docs/reqcontext.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/reqcontext.rst b/docs/reqcontext.rst index 405bca04..719d9b61 100644 --- a/docs/reqcontext.rst +++ b/docs/reqcontext.rst @@ -256,8 +256,9 @@ exceptions where it is good to know that this object is actually a proxy: - The proxy objects cannot fake their type as the actual object types. If you want to perform instance checks, you have to do that on the object being proxied. -- If the specific object reference is important, for example for - sending :ref:`signals` or passing data to a background thread. +- The reference to the proxied object is needed in some situations, + such as sending :ref:`signals` or passing data to a background + thread. If you need to access the underlying object that is proxied, use the :meth:`~werkzeug.local.LocalProxy._get_current_object` method:: From 571e92b317a8ccd86ea3a5eb3231a78529f48baa Mon Sep 17 00:00:00 2001 From: Grey Li Date: Wed, 22 Jan 2020 23:10:58 +0800 Subject: [PATCH 2/2] add import for escape in quickstart import escape from markupsafe instead of flask --- docs/quickstart.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 86b68f97..9b4fd7ba 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -200,6 +200,8 @@ You can add variable sections to a URL by marking sections with as a keyword argument. Optionally, you can use a converter to specify the type of the argument like ````. :: + from markupsafe import escape + @app.route('/user/') def show_user_profile(username): # show the user profile for that user @@ -281,7 +283,8 @@ Python shell. See :ref:`context-locals`. .. code-block:: python - from flask import Flask, escape, url_for + from flask import Flask, url_for + from markupsafe import escape app = Flask(__name__) @@ -419,9 +422,9 @@ markup to HTML) you can mark it as safe by using the :class:`~jinja2.Markup` class or by using the ``|safe`` filter in the template. Head over to the Jinja 2 documentation for more examples. -Here is a basic introduction to how the :class:`~jinja2.Markup` class works:: +Here is a basic introduction to how the :class:`~markupsafe.Markup` class works:: - >>> from flask import Markup + >>> from markupsafe import Markup >>> Markup('Hello %s!') % 'hacker' Markup(u'Hello <blink>hacker</blink>!') >>> Markup.escape('hacker') @@ -768,7 +771,8 @@ unless they know the secret key used for signing. In order to use sessions you have to set a secret key. Here is how sessions work:: - from flask import Flask, session, redirect, url_for, escape, request + from flask import Flask, session, redirect, url_for, request + from markupsafe import escape app = Flask(__name__)