[Django] #33955: AttributeError in admindocs ViewDetailView

50 views
Skip to first unread message

Django

unread,
Aug 24, 2022, 12:44:11 PM8/24/22
to django-...@googlegroups.com
#33955: AttributeError in admindocs ViewDetailView
---------------------------------------------+------------------------
Reporter: Greg Kaleka | Owner: nobody
Type: Bug | Status: new
Component: contrib.admindocs | Version: 4.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------------+------------------------
In Django 4.1, the admindocs `ViewDetailView` raises an `AttributeError`.
I'm not clear on why `_active` is missing the `local_value` attribute when
`_is_callback` is called.

Quick and dirty fix in `django/contrib/admindocs/utils.py`:

{{{
#!div style="font-size: 80%"
Code highlighting:
{{{#!python
def _is_callback(name, urlresolver=None):
if not hasattr(_active, "local_value"):
_active.local_value = _callback_strs
if urlresolver and not urlresolver._populated:
register_callback(urlresolver, _active.local_value)
return name in _active.local_value
}}}
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33955>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 24, 2022, 1:03:14 PM8/24/22
to django-...@googlegroups.com
#33955: AttributeError in admindocs ViewDetailView
-----------------------------------+--------------------------------------

Reporter: Greg Kaleka | Owner: nobody
Type: Bug | Status: new
Component: contrib.admindocs | Version: 4.1
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Description changed by Greg Kaleka:

Old description:

> In Django 4.1, the admindocs `ViewDetailView` raises an `AttributeError`.
> I'm not clear on why `_active` is missing the `local_value` attribute
> when `_is_callback` is called.
>
> Quick and dirty fix in `django/contrib/admindocs/utils.py`:
>
> {{{
> #!div style="font-size: 80%"
> Code highlighting:
> {{{#!python
> def _is_callback(name, urlresolver=None):
> if not hasattr(_active, "local_value"):
> _active.local_value = _callback_strs
> if urlresolver and not urlresolver._populated:
> register_callback(urlresolver, _active.local_value)
> return name in _active.local_value
> }}}
> }}}

New description:

In Django 4.1, the admindocs `ViewDetailView` raises an `AttributeError`.
I'm not clear on why `_active` is missing the `local_value` attribute when
`_is_callback` is called.

Reproduction steps:

1. Create a new project with Django 4.1
2. Include `django.contrib.admindocs` in your installed apps
3. Add the urls to your urlconf (`path("admindocs/",
include("django.contrib.admindocs.urls"))
4. Go to `localhost:8000/admindocs/views/` and click on any view to go to
the `ViewDetailView`

Quick and dirty fix in `django/contrib/admindocs/utils.py`:

{{{
#!div style="font-size: 80%"
Code highlighting:
{{{#!python
def _is_callback(name, urlresolver=None):
if not hasattr(_active, "local_value"):
_active.local_value = _callback_strs
if urlresolver and not urlresolver._populated:
register_callback(urlresolver, _active.local_value)
return name in _active.local_value
}}}
}}}

--

--
Ticket URL: <https://code.djangoproject.com/ticket/33955#comment:1>

Django

unread,
Aug 24, 2022, 1:04:04 PM8/24/22
to django-...@googlegroups.com
#33955: AttributeError in admindocs ViewDetailView
-----------------------------------+--------------------------------------
Reporter: Greg Kaleka | Owner: nobody
Type: Bug | Status: new
Component: contrib.admindocs | Version: 4.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Description changed by Greg Kaleka:

Old description:

> In Django 4.1, the admindocs `ViewDetailView` raises an `AttributeError`.
> I'm not clear on why `_active` is missing the `local_value` attribute
> when `_is_callback` is called.
>

> Reproduction steps:
>
> 1. Create a new project with Django 4.1
> 2. Include `django.contrib.admindocs` in your installed apps
> 3. Add the urls to your urlconf (`path("admindocs/",
> include("django.contrib.admindocs.urls"))
> 4. Go to `localhost:8000/admindocs/views/` and click on any view to go to
> the `ViewDetailView`
>
> Quick and dirty fix in `django/contrib/admindocs/utils.py`:
>
> {{{
> #!div style="font-size: 80%"
> Code highlighting:
> {{{#!python
> def _is_callback(name, urlresolver=None):
> if not hasattr(_active, "local_value"):
> _active.local_value = _callback_strs
> if urlresolver and not urlresolver._populated:
> register_callback(urlresolver, _active.local_value)
> return name in _active.local_value
> }}}
> }}}

New description:

In Django 4.1, the admindocs `ViewDetailView` raises an `AttributeError`.
I'm not clear on why `_active` is missing the `local_value` attribute when
`_is_callback` is called.

Reproduction steps:

1. Create a new project with Django 4.1
2. Include `django.contrib.admindocs` in your installed apps

3. Add the urls to your urlconf: `path("admindocs/",


include("django.contrib.admindocs.urls"))`
4. Go to `localhost:8000/admindocs/views/` and click on any view to go to
the `ViewDetailView`

Quick and dirty fix in `django/contrib/admindocs/utils.py`:

{{{
#!div style="font-size: 80%"
Code highlighting:
{{{#!python
def _is_callback(name, urlresolver=None):
if not hasattr(_active, "local_value"):
_active.local_value = _callback_strs
if urlresolver and not urlresolver._populated:
register_callback(urlresolver, _active.local_value)
return name in _active.local_value
}}}
}}}

--

--
Ticket URL: <https://code.djangoproject.com/ticket/33955#comment:2>

Django

unread,
Aug 24, 2022, 3:07:15 PM8/24/22
to django-...@googlegroups.com
#33955: AttributeError in admindocs ViewDetailView
-----------------------------------+--------------------------------------
Reporter: Greg Kaleka | Owner: nobody
Type: Bug | Status: new
Component: contrib.admindocs | Version: 4.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Description changed by Greg Kaleka:

Old description:

> In Django 4.1, the admindocs `ViewDetailView` raises an `AttributeError`.
> I'm not clear on why `_active` is missing the `local_value` attribute
> when `_is_callback` is called.
>
> Reproduction steps:
>
> 1. Create a new project with Django 4.1
> 2. Include `django.contrib.admindocs` in your installed apps

> 3. Add the urls to your urlconf: `path("admindocs/",

New description:

Reproduction steps:

and here's the full traceback before the fix:

{{{
Internal Server Error:
/admindocs/views/django.contrib.admindocs.views.BaseAdminDocsView/
Traceback (most recent call last):
File "/Users/gkaleka/dev/testing/django_41_testfix/.venv/lib/python3.9
/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/Users/gkaleka/dev/testing/django_41_testfix/.venv/lib/python3.9
/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args,
**callback_kwargs)
File "/Users/gkaleka/dev/testing/django_41_testfix/.venv/lib/python3.9
/site-packages/django/views/generic/base.py", line 103, in view
return self.dispatch(request, *args, **kwargs)
File "/Users/gkaleka/dev/testing/django_41_testfix/.venv/lib/python3.9
/site-packages/django/utils/decorators.py", line 46, in _wrapper
return bound_method(*args, **kwargs)
File "/Users/gkaleka/dev/testing/django_41_testfix/.venv/lib/python3.9
/site-packages/django/contrib/auth/decorators.py", line 23, in
_wrapped_view
return view_func(request, *args, **kwargs)
File "/Users/gkaleka/dev/testing/django_41_testfix/.venv/lib/python3.9
/site-packages/django/contrib/admindocs/views.py", line 50, in dispatch
return super().dispatch(request, *args, **kwargs)
File "/Users/gkaleka/dev/testing/django_41_testfix/.venv/lib/python3.9
/site-packages/django/views/generic/base.py", line 142, in dispatch
return handler(request, *args, **kwargs)
File "/Users/gkaleka/dev/testing/django_41_testfix/.venv/lib/python3.9
/site-packages/django/views/generic/base.py", line 216, in get
context = self.get_context_data(**kwargs)
File "/Users/gkaleka/dev/testing/django_41_testfix/.venv/lib/python3.9
/site-packages/django/contrib/admindocs/views.py", line 185, in
get_context_data
view_func = self._get_view_func(view)
File "/Users/gkaleka/dev/testing/django_41_testfix/.venv/lib/python3.9
/site-packages/django/contrib/admindocs/views.py", line 169, in
_get_view_func
if _is_callback(view):
File "/Users/gkaleka/dev/testing/django_41_testfix/.venv/lib/python3.9
/site-packages/django/contrib/admindocs/utils.py", line 258, in
_is_callback
return name in _active.local_value
File "/Users/gkaleka/dev/testing/django_41_testfix/.venv/lib/python3.9
/site-packages/asgiref/local.py", line 105, in __getattr__
raise AttributeError(f"{self!r} object has no attribute {key!r}")
AttributeError: <asgiref.local.Local object at 0x10a4f7670> object has no
attribute 'local_value'
}}}

--

--
Ticket URL: <https://code.djangoproject.com/ticket/33955#comment:3>

Django

unread,
Aug 24, 2022, 3:24:05 PM8/24/22
to django-...@googlegroups.com

Old description:

New description:

In Django 4.1, the admindocs `ViewDetailView` raises an `AttributeError`.
I'm not clear on why `_active` is missing the `local_value` attribute when
`_is_callback` is called.

Reproduction steps:

1. Create a new project with Django 4.1

2. Run `manage.py migrate` and `manage.py createsuperuser`
3. Include `django.contrib.admindocs` in your installed apps
4. Add the urls to your urlconf: `path("admindocs/",
include("django.contrib.admindocs.urls"))`
5. Go to `localhost:8000/admindocs/views/` and click on any view to go to
the `ViewDetailView`

Quick and dirty fix in `django/contrib/admindocs/utils.py`:

{{{
#!div style="font-size: 80%"
Code highlighting:
{{{#!python
def _is_callback(name, urlresolver=None):
if not hasattr(_active, "local_value"):
_active.local_value = _callback_strs
if urlresolver and not urlresolver._populated:
register_callback(urlresolver, _active.local_value)
return name in _active.local_value
}}}
}}}

--

--
Ticket URL: <https://code.djangoproject.com/ticket/33955#comment:4>

Django

unread,
Aug 24, 2022, 3:25:11 PM8/24/22
to django-...@googlegroups.com
#33955: AttributeError in admindocs ViewDetailView
-----------------------------------+--------------------------------------
Reporter: Greg Kaleka | Owner: nobody
Type: Bug | Status: new
Component: contrib.admindocs | Version: 4.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Description changed by Greg Kaleka:

Old description:

> In Django 4.1, the admindocs `ViewDetailView` raises an `AttributeError`.
> I'm not clear on why `_active` is missing the `local_value` attribute
> when `_is_callback` is called.
>
> Reproduction steps:
>
> 1. Create a new project with Django 4.1

> 2. Run `manage.py migrate` and `manage.py createsuperuser`
> 3. Include `django.contrib.admindocs` in your installed apps
> 4. Add the urls to your urlconf: `path("admindocs/",
> include("django.contrib.admindocs.urls"))`
> 5. Go to `localhost:8000/admindocs/views/` and click on any view to go to
> the `ViewDetailView`
>
> Quick and dirty fix in `django/contrib/admindocs/utils.py`:
>
> {{{
> #!div style="font-size: 80%"
> Code highlighting:
> {{{#!python
> def _is_callback(name, urlresolver=None):
> if not hasattr(_active, "local_value"):
> _active.local_value = _callback_strs
> if urlresolver and not urlresolver._populated:
> register_callback(urlresolver, _active.local_value)
> return name in _active.local_value
> }}}
> }}}

New description:

In Django 4.1, the admindocs `ViewDetailView` raises an `AttributeError`.
I'm not clear on why `_active` is missing the `local_value` attribute when
`_is_callback` is called.

Reproduction steps:

1. Create a new project with Django 4.1

2. Include `django.contrib.admindocs` in your installed apps
3. Add the urls to your urlconf: `path("admindocs/",
include("django.contrib.admindocs.urls"))`

4. Run `manage.py migrate` and `manage.py createsuperuser`


5. Go to `localhost:8000/admindocs/views/` and click on any view to go to
the `ViewDetailView`

Quick and dirty fix in `django/contrib/admindocs/utils.py`:

{{{
#!div style="font-size: 80%"
Code highlighting:
{{{#!python
def _is_callback(name, urlresolver=None):
if not hasattr(_active, "local_value"):
_active.local_value = _callback_strs
if urlresolver and not urlresolver._populated:
register_callback(urlresolver, _active.local_value)
return name in _active.local_value
}}}
}}}

--

--
Ticket URL: <https://code.djangoproject.com/ticket/33955#comment:5>

Django

unread,
Aug 25, 2022, 12:23:41 AM8/25/22
to django-...@googlegroups.com
#33955: AttributeError in admindocs ViewDetailView
-----------------------------------+------------------------------------
Reporter: Greg Kaleka | Owner: nobody
Type: Bug | Status: new
Component: contrib.admindocs | Version: 4.1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

* cc: Carlton Gibson, Alokik Roy (added)
* has_patch: 1 => 0
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted


Comment:

Thanks for the report.

Regression in 7f3cfaa12b28d15c0ca78bb692bfd6e59d17bff1.

--
Ticket URL: <https://code.djangoproject.com/ticket/33955#comment:6>

Django

unread,
Aug 29, 2022, 3:58:50 AM8/29/22
to django-...@googlegroups.com
#33955: AttributeError in admindocs ViewDetailView
-----------------------------------+---------------------------------------
Reporter: Greg Kaleka | Owner: Greg Kaleka
Type: Bug | Status: assigned

Component: contrib.admindocs | Version: 4.1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+---------------------------------------
Changes (by Mariusz Felisiak):

* owner: nobody => Greg Kaleka
* status: new => assigned
* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/15994 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/33955#comment:7>

Django

unread,
Aug 29, 2022, 4:06:11 AM8/29/22
to django-...@googlegroups.com
#33955: AttributeError in admindocs ViewDetailView
-----------------------------------+---------------------------------------
Reporter: Greg Kaleka | Owner: Greg Kaleka
Type: Bug | Status: assigned
Component: contrib.admindocs | Version: 4.1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+---------------------------------------
Changes (by Carlton Gibson):

* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/33955#comment:8>

Django

unread,
Sep 1, 2022, 6:53:45 AM9/1/22
to django-...@googlegroups.com
#33955: AttributeError in admindocs ViewDetailView
-------------------------------------+-------------------------------------
Reporter: Greg Kaleka | Owner: Mariusz
| Felisiak

Type: Bug | Status: assigned
Component: contrib.admindocs | Version: 4.1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* owner: Greg Kaleka => Mariusz Felisiak
* needs_tests: 1 => 0


Comment:

[https://github.com/django/django/pull/16024 Alternative PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/33955#comment:9>

Django

unread,
Sep 1, 2022, 3:09:50 PM9/1/22
to django-...@googlegroups.com
#33955: AttributeError in admindocs ViewDetailView
-------------------------------------+-------------------------------------
Reporter: Greg Kaleka | Owner: Mariusz
| Felisiak
Type: Bug | Status: closed
Component: contrib.admindocs | Version: 4.1
Severity: Release blocker | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by GitHub <noreply@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"974942a75039ba43e618f6a5ff95e08b5d5176fd" 974942a7]:
{{{
#!CommitTicketReference repository=""
revision="974942a75039ba43e618f6a5ff95e08b5d5176fd"
Fixed #33955, Fixed #33971 -- Reverted "Fixed #32565 -- Moved internal
URLResolver view-strings mapping to admindocs."

This reverts commit 7f3cfaa12b28d15c0ca78bb692bfd6e59d17bff1.

Thanks Tom Carrick and Greg Kaleka for reports.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33955#comment:10>

Django

unread,
Sep 1, 2022, 3:12:17 PM9/1/22
to django-...@googlegroups.com
#33955: AttributeError in admindocs ViewDetailView
-------------------------------------+-------------------------------------
Reporter: Greg Kaleka | Owner: Mariusz
| Felisiak
Type: Bug | Status: closed
Component: contrib.admindocs | Version: 4.1
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"a1083805acc952419752bc8fd860bfda83af42d2" a108380]:
{{{
#!CommitTicketReference repository=""
revision="a1083805acc952419752bc8fd860bfda83af42d2"
[4.1.x] Fixed #33955, Fixed #33971 -- Reverted "Fixed #32565 -- Moved


internal URLResolver view-strings mapping to admindocs."

This reverts commit 7f3cfaa12b28d15c0ca78bb692bfd6e59d17bff1.

Thanks Tom Carrick and Greg Kaleka for reports.

Backport of 974942a75039ba43e618f6a5ff95e08b5d5176fd from main
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33955#comment:11>

Reply all
Reply to author
Forward
0 new messages