title: Flask's url_for raises TypeError: 'function' object has no attribute '__getitem__'
body: <p>I'm trying to generate a url for my details route and redirect to it.  I call <code>redirect(url_for(details))</code>, but get <code>TypeError: 'function' object has no attribute '__getitem__'</code>.  What am I doing wrong?</p>
  
  <pre><code>@app.route('/search_process')
  def search():
      return redirect(url_for(details))
  
  @app.route('/details')
  def details():
      return 'details'
  </code></pre>
  
  
  
  <pre><code>Traceback (most recent call last):
    File "/Library/Python/2.7/site-packages/flask/app.py", line 1836, in __call__
      return self.wsgi_app(environ, start_response)
    File "/Library/Python/2.7/site-packages/flask/app.py", line 1820, in wsgi_app
      response = self.make_response(self.handle_exception(e))
    File "/Library/Python/2.7/site-packages/flask/app.py", line 1403, in handle_exception
      reraise(exc_type, exc_value, tb)
    File "/Library/Python/2.7/site-packages/flask/app.py", line 1817, in wsgi_app
      response = self.full_dispatch_request()
    File "/Library/Python/2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
      rv = self.handle_user_exception(e)
    File "/Library/Python/2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
      reraise(exc_type, exc_value, tb)
    File "/Library/Python/2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
      rv = self.dispatch_request()
    File "/Library/Python/2.7/site-packages/flask/app.py", line 1461, in dispatch_request
      return self.view_functions[rule.endpoint](**req.view_args)
    File "/Users/Rabbit/PycharmProjects/Final_Project/Final_Project.py", line 59, in search
      return redirect(url_for(details))
    File "/Library/Python/2.7/site-packages/flask/helpers.py", line 268, in url_for
      if endpoint[:1] == '.':
  
  TypeError: 'function' object has no attribute '__getitem__'
  </code></pre>