title: Django decorator from middleware with different args per view function
body: <p>I have an SSO middleware in my Django project, to which I need to pass an argument.</p>
  
  <p>In my <code>views.py</code> file I have different view functions which all get decorated with <code>decorator_from_middleware_with_args</code> but have different arguments:</p>
  
  <pre><code>sso_decorator = decorator_from_middleware_with_args(SSOMiddleware)
  
  @sso_decorator(True):
  def index():
      ...
  
  @sso_decorator(False):
  def view():
      ...
  </code></pre>
  
  <p>And here is my middleware class:</p>
  
  <pre><code>class SSOMiddleware:
  
      def __init__(self, some_arg=False):
          self.some_arg = some_arg
  
      def process_request(self, request):
          print self.some_arg
  </code></pre>
  
  <p>When I access the index view via url, the output that I get in the console is:</p>
  
  <pre><code>Some argument: False
  Some argument: True
  </code></pre>
  
  <p>I have two questions here:</p>
  
  <p>Why is the process_request function executed twice?
  Why does it have a different argument?</p>