HassenPy / django-pdb

Gives you `manage.py runserver --pdb` and `manage.py test --pdb`
394 stars 61 forks source link

Error after django upgrade to 4.1 #55

Open sebhaase opened 2 years ago

sebhaase commented 2 years ago

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 initfuncton:

    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 commented 2 years ago

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

cpontvieux-systra commented 1 year ago

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 commented 1 year ago

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

cpontvieux-systra commented 1 year ago

@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 commented 1 year ago

@sebhaase Can you propose a merge request?

sebhaase commented 1 year ago

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

cpontvieux-systra commented 11 months ago

One year later… Is this project still maintained?