tolomea / django-data-browser

Django app for user friendly querying of Django models
BSD 3-Clause "New" or "Revised" License
350 stars 28 forks source link

'ASGIRequest' object has no attribute 'environ' #63

Closed tgrigoruk closed 1 year ago

tgrigoruk commented 1 year ago

Greetings šŸ‘‹, On upgrade from 4.2.1 to 4.2.2 DDB broke, raising the titular AttributeError.

Traceback (most recent call last):
  File "/home/django/.asdf/installs/python/3.11.4/lib/python3.11/site-packages/django/core/handlers/exception.py", line 43, in inner
    response = await get_response(request)
  File "/home/django/.asdf/installs/python/3.11.4/lib/python3.11/site-packages/django/core/handlers/base.py", line 253, in _get_response_async
    response = await wrapped_callback(
  File "/home/django/.asdf/installs/python/3.11.4/lib/python3.11/site-packages/sentry_sdk/integrations/django/views.py", line 84, in sentry_wrapped_callback
    return callback(request, *args, **kwargs)
  File "/home/django/.asdf/installs/python/3.11.4/lib/python3.11/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/home/django/.asdf/installs/python/3.11.4/lib/python3.11/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/home/django/.asdf/installs/python/3.11.4/lib/python3.11/site-packages/django/utils/decorators.py", line 134, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/home/django/.asdf/installs/python/3.11.4/lib/python3.11/site-packages/django/utils/decorators.py", line 134, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/home/django/.asdf/installs/python/3.11.4/lib/python3.11/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/home/django/.asdf/installs/python/3.11.4/lib/python3.11/site-packages/data_browser/common.py", line 209, in wrapper
    with self:
  File "/home/django/.asdf/installs/python/3.11.4/lib/python3.11/site-packages/data_browser/common.py", line 225, in __enter__
    state = _State(self.old, request=self.request, **self.kwargs)
  File "/home/django/.asdf/installs/python/3.11.4/lib/python3.11/site-packages/data_browser/common.py", line 169, in __init__
    new_request.environ = request.environ

Exception Type: AttributeError at /data-browser/
Exception Value: 'ASGIRequest' object has no attribute 'environ'
tolomea commented 1 year ago

Well that's annoying but easily fixed. I wonder if any ASGI is going to break any other stuff.

tolomea commented 1 year ago

I did a 4.2.3 that resolves this. Please let me know if you have any further issues. Setting up my own ASGI test / test environment will take more time.

tgrigoruk commented 1 year ago

Thank you for the quick update. All's good now šŸ™‡šŸ˜„

tolomea commented 1 year ago

That's good news