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

SQLAlchemyMiddleware does not return response #142

Closed
esquonk opened this issue Jul 14, 2019 · 4 comments · Fixed by #143
Closed

SQLAlchemyMiddleware does not return response #142

esquonk opened this issue Jul 14, 2019 · 4 comments · Fixed by #143
Labels
bug Something isn't working

Comments

@esquonk
Copy link

esquonk commented Jul 14, 2019

SQLAlchemyMiddleware does not return response object and breaks middleware chain

        finally:
            self.return_response(request, response)

This commit appears to cause the issue.

Am I missing something here?

@esquonk
Copy link
Author

esquonk commented Jul 14, 2019

I get the following error when I put django_sorcery.db.middleware.SQLAlchemyMiddleware at the top of MIDDLEWARE list.

Traceback (most recent call last):
  File "C:\Program Files\Python37\lib\wsgiref\handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "C:\Users\mi\proj\venv\flights\lib\site-packages\django\contrib\staticfiles\handlers.py", line 65, in __call__
    return self.application(environ, start_response)
  File "C:\Users\mi\proj\venv\flights\lib\site-packages\django\core\handlers\wsgi.py", line 141, in __call__
    response = self.get_response(request)
  File "C:\Users\mi\proj\venv\flights\lib\site-packages\django\core\handlers\base.py", line 76, in get_response
    response._closable_objects.append(request)
AttributeError: 'NoneType' object has no attribute '_closable_objects'

@shosca
Copy link
Owner

shosca commented Jul 14, 2019

You're correct, it should return response there

@shosca
Copy link
Owner

shosca commented Jul 14, 2019

Please try the fix. You can install it with pip install https://github.com/shosca/django-sorcery/archive/middleware.zip

@shosca shosca added the bug Something isn't working label Jul 14, 2019
@esquonk
Copy link
Author

esquonk commented Jul 15, 2019

Thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants