title: redirect while passing arguments
body: <p>In flask, I can do this:</p>
  
  <pre><code>render_template("foo.html", messages={'main':'hello'})
  </code></pre>
  
  <p>And if foo.html contains <code>{{ messages['main'] }}</code>, the page will show <code>hello</code>. But what if there's a route that leads to foo:</p>
  
  <pre><code>@app.route("/foo")
  def do_foo():
      # do some logic here
      return render_template("foo.html")
  </code></pre>
  
  <p>In this case, the only way to get to foo.html, if I want that logic to happen anyway, is through a <code>redirect</code>:</p>
  
  <pre><code>@app.route("/baz")
  def do_baz():
      if some_condition:
          return render_template("baz.html")
      else:
          return redirect("/foo", messages={"main":"Condition failed on page baz"}) 
          # above produces TypeError: redirect() got an unexpected keyword argument 'messages'
  </code></pre>
  
  <p>So, how can I get that <code>messages</code> variable to be passed to the <code>foo</code> route, so that I don't have to just rewrite the same logic code that that route computes before loading it up?</p>