title: Flask - duplicates flash messages
body: <p>I have problem with flask <a href="http://flask.pocoo.org/docs/0.12/patterns/flashing/" rel="nofollow noreferrer"><code>flash()</code></a> function, <code>get_flashed_messages()</code> always returns me duplicates.
  I set flash for logout :</p>
  
  <pre><code>@app.route('/logout')
  def logout():
      session.pop('logged_in', None)
      flash('You are logged out!', 'success')
      return redirect(url_for('home'))
  </code></pre>
  
  <p>and in view I have:</p>
  
  <pre><code>{% with messages = get_flashed_messages(with_categories=true) %}
      {% if messages %}
          {% for type, message in messages %}
              &lt;div class="callout {{ type }}"&gt;
                  {{ message }}
              &lt;/div&gt;
          {% endfor %}
      {% endif %}
  {% endwith %}
  </code></pre>
  
  <p>Is it a flask bug? I have printed <code>messages</code> variable and this have more than 1 flash logout message, the count of messages is in range 1-3.</p>