question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Few middleware problems? Django 1.11.2

See original GitHub issue

middleware.py

                our_decorator = watch_login()
                watch_login_method = method_decorator(our_decorator)

Whats the point of this mess? Besides it throwing TypeError: watch_login() takes exactly 1 argument (0 given) can’t it be just one line like it was before?

Like this: watch_login_method = method_decorator(watch_login)

Also for django-defender to work with the new django MIDDLEWARE I need to do the following to the middleware:

try:
    from django.utils.deprecation import MiddlewareMixin as MIDDLEWARE_BASE_CLASS
except ImportError:
    MIDDLEWARE_BASE_CLASS = object

Add this on top of the middleware.py and then swap the class FailedLoginMiddleware(object): to class FailedLoginMiddleware(MIDDLEWARE_BASE_CLASS):

Without doing these changes to the current middleware.py django runserver doesn’t even “start”. I am on django 1.11.2

Is the current 0.5 version actually running on someones django 1.11.x project? 😂

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kencochranecommented, Aug 2, 2017

@Temeez can we close this issue?

0reactions
Temeezcommented, Jul 4, 2017

Odd, I don’t get the TypeError from the watch_login() anymore and I have done no code changes… magic!

I’ll make a PR for the MIDDLEWARE thing so it won’t throw TypeError: object.__init__() takes no parameters error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Middleware - Django documentation
Middleware is a framework of hooks into Django's request/response processing. It's a light, low-level “plugin” system for globally altering Django's input or ...
Read more >
After upgrade to Django 1.11 append_slash no longer works
No, SessionAuthenticationMiddleware shouldn't cause any problems. In Django 1.11 it's a stub class for backwards compatibility reasons. It doesn ...
Read more >
Django 2.2 Upgrade Issues and Lessons Learned
This is a collection of issues we encountered with the Django 2.2 upgrade and ... use the newer style of Django middleware introduced...
Read more >
TypeError: __init__() takes exactly 2 arguments (1 given) #25
Django ==1.11.8 aws-xray-sdk==0.95 Traceback (most recent call last): ... Changing to MIDDLEWARE got rid of the error in this issue but is ...
Read more >
10 Tips for Upgrading to Django 2.0 - Eldarion
The much anticipated Django 2.0 was recently released and we are updating Pinax ... to share our process and some of the most...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found