django-pdb icon indicating copy to clipboard operation
django-pdb copied to clipboard

Error after django upgrade to 4.1

Open sebhaase opened this issue 2 years ago • 7 comments

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 avatar Aug 26 '22 13:08 sebhaase

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

sebhaase avatar Aug 26 '22 13:08 sebhaase

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

cpontvieux-systra avatar Sep 10 '22 14:09 cpontvieux-systra

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

sebhaase avatar Sep 11 '22 19:09 sebhaase

@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 avatar Sep 13 '22 12:09 cpontvieux-systra

@sebhaase Can you propose a merge request?

cpontvieux-systra avatar Sep 13 '22 12:09 cpontvieux-systra

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

sebhaase avatar Sep 13 '22 14:09 sebhaase

One year later… Is this project still maintained?

cpontvieux-systra avatar Sep 14 '23 19:09 cpontvieux-systra