title: Using defaults with app.add_url_rule in Flask
body: <p>I am setting a url endpoint with the following:</p>
  
  <p><strong>manager.py</strong></p>
  
  <pre><code>from xxx import ContactAPI
  from xxx.models import Contact
  
  # self.app is my Flask app
  # self.session is SQLAlchemy Session
  
  api_name = 'contact'
  instance_endpoint = '/%s/&lt;int:instid&gt;' % api_name
  methods = ['GET']
  
  api_view = ContactAPI.as_view(api_name, self.session,
                                Contact, app)
  
  self.app.add_url_rule(instance_endpoint, methods=methods, 
                        defaults={'instid': None},
                        view_func=api_view)
  </code></pre>
  
  <p>And overriding <code>get()</code> in my ContactAPI class:</p>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>from flask.views import MethodView
  
  class ContactAPI(MethodView):
  
      def __init__(self, session, model, app, *args, **kwargs):
          super(ContactAPI, self).__init__(*args, **kwargs)
  
      def get(self, instid):
          print instid
  </code></pre>
  
  <p>When I hit the URL <code>/contact/1</code> I get <code>instid</code> printed as <code>None</code>.</p>
  
  <p>When I remove the <code>defaults={'instid': None},</code> line from manager.py, I get <code>instid</code> printed as 1.</p>
  
  <p>Why is having the defaults line in my call to <code>add_url_rule</code> overriding what I'm putting in my URL?</p>