Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pinax-teams middleware error #63

Open
Tikam02 opened this issue Mar 22, 2018 · 7 comments
Open

pinax-teams middleware error #63

Tikam02 opened this issue Mar 22, 2018 · 7 comments

Comments

@Tikam02
Copy link

Tikam02 commented Mar 22, 2018

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

File "/root/Desktop/pin/site/lib/python3.6/site-packages/django/core/handlers/wsgi.py", line 140, in init
self.load_middleware()
File "/root/Desktop/pin/site/lib/python3.6/site-packages/django/core/handlers/base.py", line 39, in load_middleware
mw_instance = middleware(handler)
TypeError: object() takes no parameters

@grahamu
Copy link
Contributor

grahamu commented Mar 22, 2018

Good catch @Tikam02, thanks.

pinax-teams is a Pinax app, but not part of the "official" apps seen by invoking pinax apps:

$ pinax apps
Release Application
------- ---------------
  2.0.3 django-user-accounts
  3.0.2 pinax-announcements
  7.0.1 pinax-blog
  2.0.4 pinax-calendars
  2.0.3 pinax-eventlog
  2.0.3 pinax-events
  3.0.1 pinax-images
  6.1.2 pinax-invitations
  3.0.1 pinax-likes
  2.0.2 pinax-messages
  2.0.3 pinax-news
  5.0.3 pinax-notifications
  4.0.0 pinax-stripe
  2.0.4 pinax-testimonials
  2.0.3 pinax-waitinglist
  4.0.2 pinax-webanalytics

Why is pinax-teams not an "official" Pinax app? Because pinax-teams has incomplete documentation and incomplete tests and is not yet fully compatible with Django v2.0.

In this particular case, it appears TeamMiddleware is designed for the old-style "MIDDLEWARE_CLASSES". It is not yet upgraded to Django v2.0 "MIDDLEWARE" nor is it using the "MiddlewareMixin" class. Furthermore, there are no tests proving the middleware works as intended.

We'd love your help @Tikam02 if you feel inclined to submit a PR with tests which fixes the problem. Thanks!

@grahamu
Copy link
Contributor

grahamu commented Mar 23, 2018

Here's the test coverage for pinax-teams: https://codecov.io/gh/pinax/pinax-teams/tree/master/pinax/teams

@Tikam02 note middleware.py has 0% coverage. Apparently you're the first dev upgrading to the latest pinax-teams who is using TeamMiddleware with Django 2.0.

@Tikam02
Copy link
Author

Tikam02 commented Mar 23, 2018

@grahamu Thank you so much for the information and guidance.
Sure I'll do PR once i solved some of the issues and after my project i want to contribute to fix pinax issues.It's really an awesome framework.
So, should i wait for the updates or your code from the above link provided will work.Because i need this app, hosting team event for my site.

@grahamu
Copy link
Contributor

grahamu commented Mar 23, 2018

@Tikam02 Thanks for your PR offer! We're always happy for community help.

Preferably convert TeamMiddleware to new-style MIDDLEWARE.

I'm not sure what you mean by "the above link provided" as the only link I've provided in this story shows test coverage.

There is no planned update to pinax-teams at the moment so don't wait for us!

@grahamu
Copy link
Contributor

grahamu commented Mar 23, 2018

@Tikam02 one more thought... in order to move forward on your project, perhaps updating TeamMiddleware to inherit from the MiddlewareMixin class is a good short-term solution. Again PRs welcome!

@Tikam02
Copy link
Author

Tikam02 commented Mar 23, 2018

Sure i'll try and again Thanks for the Information.

@kichik
Copy link

kichik commented Oct 30, 2021

To work around this issue you can create the following class:

from django.utils.deprecation import MiddlewareMixin
from pinax.teams.middleware import TeamMiddleware

class CompatibleTeamMiddleware(MiddlewareMixin, TeamMiddleware):
    pass

And then point to it instead of the original middleware. For example:

MIDDLEWARE = [
    # ....
    'myapp.middleware.CompatibleTeamMiddleware',
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants