From de411c431119a81afa63af5e804329810de16d14 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 11 Feb 2021 13:30:01 +0100 Subject: [PATCH] [Session] Remove some unneeded example --- session.rst | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/session.rst b/session.rst index 8d465516a58..fb9bb81cd8a 100644 --- a/session.rst +++ b/session.rst @@ -196,22 +196,6 @@ the existence of data in the session. This may hurt your application performance because all users will receive a session cookie. In order to prevent that, you must *completely* avoid accessing the session. -For example, if your templates include some code to display the -:ref:`flash messages `, sessions will start even if the user -is not logged in and even if you haven't created any flash messages. To avoid -this behavior, add a check before trying to access the flash messages: - -.. code-block:: html+twig - - {# this check prevents starting a session when there are no flash messages #} - {% if app.request.hasPreviousSession %} - {% for message in app.flashes('notice') %} -
- {{ message }} -
- {% endfor %} - {% endif %} - More about Sessions -------------------