title: Python function is not defined
body: <p>I face a function undefined error when I run the server (FLASK app):</p>
  
  <p><strong>NameError: name 'format_date' is not defined</strong>
  <a href="https://i.stack.imgur.com/4IlQV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4IlQV.jpg" alt="enter image description here"></a></p>
  
  <p>This is all my code so far:</p>
  
  <pre><code>from flask import Flask, render_template
  import markdown
  import os
  from werkzeug import cached_property
  import yaml
  
  POSTS_FILE_EXTENSION = '.md'
  app = Flask(__name__)
  
  class Post(object):
      def __init__(self,path):
          self.path=path
          self._initialize_metadata()
  
      @cached_property
      def html(self):
          with open(self.path, 'r') as fin:
              content= fin.read().split('\n\n',1)[1].strip()
          return markdown.markdown(content)
  
      def _initialize_metadata(self):
          content = ''
          with open(self.path, 'r') as fin:
              for line in fin:
                  if not line.strip():
                      break
                  content +=line
          self.__dict__.update(yaml.load(content))
  
      def format_date(value, format='%B %d, %Y'):
          return value.strftime(format)
  
  @app.route('/')
  def index():
      return 'Hello, world!'
  
  @app.route('/blog/&lt;path:path&gt;')
  def post(path):
      #import ipdb; ipdb.set_trace()
      path = os.path.join('posts', path+'.md')
      post = Post(path)
      return render_template('post.html', post=post, format_date=format_date)
  
  
  if __name__ == '__main__':
      app.run(port=8000, debug=True)
  </code></pre>
  
  <p>Why does it say undefined? I defined it. :|</p>
  
  <p><strong>post.html:</strong></p>
  
  <pre><code>&lt;h3 id='date'&gt;{{format_date(post.date)}}&lt;/h3&gt;
  </code></pre>
  
  <p><strong>hello.md:</strong></p>
  
  <pre><code>title: Hello, worldtitle!
  date: 2013-03-25
  
  # Hello WOrld
  
  ### This is an H3 level header
  </code></pre>
  
  <p>P.S. : Don't judge me, I'm a noob.</p>