yceruto/django-ajax

MiddleWare Error

fmatray opened this issue · 3 comments

Hello,
I get this error when I load the middleware with django 1.11:

 mw_instance = middleware(handler)
TypeError: object() takes no parameters

I added this to correct the message

class AJAXMiddleware(object):
    def __init__(self, get_response):
        self.get_response = get_response

    def __call__(self, request):
        response = self.get_response(request)
        return response


Thanks for reporting this bug, I'll take a look ASAP!

Sorry, I can't reproduce the issue, see passed tests for django 1.11 (https://travis-ci.org/yceruto/django-ajax/builds/269619322)

Are you sure AJAXMiddleware is configured like this:

# settings.py

MIDDLEWARE_CLASSES = (
    # ...
    'django_ajax.middleware.AJAXMiddleware',
)

Note that when you're using AJAXMiddleware you can't use @ajax decorator at same time.

Please, reopen this issue if the problem persists, thanks.