Skip to content

Error after django upgrade to 4.1 #55

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

Open
sebhaase opened this issue Aug 26, 2022 · 7 comments
Open

Error after django upgrade to 4.1 #55

sebhaase opened this issue Aug 26, 2022 · 7 comments

Comments

@sebhaase
Copy link

AttributeError: 'PdbMiddleware' object has no attribute '_is_coroutine'
seems to be coming from not calling super().__init__() in the PdbMiddleware
I added line 41 - first line in the __init__functon:

    def __init__(self, get_response=None, debug_only=True):
        """
        If debug_only is True, this middleware removes itself
        unless settings.DEBUG is also True. Otherwise, this middleware
        is always active.
        """
        super().__init__(get_response)
        self.get_response = get_respose
        if debug_only and not settings.DEBUG:
            raise MiddlewareNotUsed()

that in turn calls _async_check() correctly from class deprecation.MiddlewareMixin

@sebhaase
Copy link
Author

2nd line self.get_response = get_response should be removed then...

@cpontvieux-systra
Copy link

I patched it with

from django_pdb.middleware import PdbMiddleware
if not hasattr(PdbMiddleware, '_is_coroutine'):
     setattr(PdbMiddleware, '_is_coroutine', False)

But it’s better in the super is called correctly

@sebhaase
Copy link
Author

why did you not want to call super().init?

@cpontvieux-systra
Copy link

@sebhaase I’m not a django-pdb developper. I just answer how I patched in on my project waiting for this issue to be resolved (using a call to super().__init__)

@cpontvieux-systra
Copy link

@sebhaase Can you propose a merge request?

@sebhaase
Copy link
Author

I suppose we should wait until "a maintainer/author" of this project shows up...

cpontvieux-systra pushed a commit to cpontvieux-systra/django-pdb that referenced this issue Sep 13, 2022
@cpontvieux-systra
Copy link

One year later… Is this project still maintained?

stuaxo added a commit to stuaxo/django-pdb that referenced this issue Dec 5, 2023
Issue HassenPy#55: Fix PdbMiddleware with django >= 4.1
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

2 participants