[Django] #29296: admindocs crash if a Feed is configured

5 views
Skip to first unread message

Django

unread,
Apr 6, 2018, 9:28:36 AM4/6/18
to django-...@googlegroups.com
#29296: admindocs crash if a Feed is configured
-----------------------------------------+------------------------
Reporter: Paul Donohue | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 2.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
If a Feed (https://docs.djangoproject.com/en/2.0/ref/contrib/syndication/)
is configured anywhere in the project, then /admin/doc/views/
(https://docs.djangoproject.com/en/2.0/ref/contrib/admin/admindocs/)
crashes with AttributeError: `'GlobalFeed' object has no attribute
'__qualname__'`

The problem is that Feed is a callable object
(https://github.com/django/django/blob/master/django/contrib/syndication/views.py#L34)
and the documentation uses that class directly as a View
(`path('latest/feed/', LatestEntriesFeed()),`), but admindocs assumes that
all views are functions and it does not work properly with a callable
object
(https://github.com/django/django/blob/master/django/contrib/admindocs/views.py#L130).

In Django 1.11 and earlier, admindocs supported callable objects on Python
2 by falling back to `view.__class__.__name__`, but it appears that the
Python 3 code in admindocs has never supported this.
(https://github.com/django/django/blob/1.11.12/django/contrib/admindocs/views.py#L135)

As a work-around, `__qualname__` can be manually defined on Feed objects:

{{{
class MyFeed(Feed):
def __init__(self):
super().__init__()
self.__qualname__ = '__call__'
}}}

Without knowing Django's opinion of the use of callable objects as views,
I don't know the appropriate way to fix this: Should admindocs support
callable objects as views, or should Feed not use a callable object as a
view?

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

Django

unread,
Apr 6, 2018, 9:34:03 AM4/6/18
to django-...@googlegroups.com
#29296: admindocs crash if a Feed is configured
-------------------------------+--------------------------------------

Reporter: Paul Donohue | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 2.0
Severity: Normal | Resolution:

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

Old description:

New description:

If a Feed (https://docs.djangoproject.com/en/2.0/ref/contrib/syndication/)
is configured anywhere in the project, then /admin/doc/views/
(https://docs.djangoproject.com/en/2.0/ref/contrib/admin/admindocs/)
crashes with AttributeError: `'GlobalFeed' object has no attribute
'__qualname__'`

The problem is that Feed is a callable object
(https://github.com/django/django/blob/master/django/contrib/syndication/views.py#L34)
and the documentation uses that class directly as a View
(`path('latest/feed/', LatestEntriesFeed()),`), but admindocs assumes that
all views are functions and it does not work properly with a callable
object
(https://github.com/django/django/blob/master/django/contrib/admindocs/views.py#L130).

In Django 1.11 and earlier, admindocs supported callable objects on Python
2 by falling back to `view.__class__.__name__`, but it appears that the

Python 3 code in admindocs has not supported this since it was added in
https://github.com/django/django/commit/ae0f55eb491255217d6df31296ec8102007224a6
(https://code.djangoproject.com/ticket/27018).

As a work-around, `__qualname__` can be manually defined on Feed objects:

{{{
class MyFeed(Feed):
def __init__(self):
super().__init__()
self.__qualname__ = '__call__'
}}}

Without knowing Django's opinion of the use of callable objects as views,
I don't know the appropriate way to fix this: Should admindocs support
callable objects as views, or should Feed not use a callable object as a
view?

--

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

Django

unread,
Apr 6, 2018, 10:39:56 AM4/6/18
to django-...@googlegroups.com
#29296: admindocs crash if a Feed is configured
-------------------------------+--------------------------------------

Reporter: Paul Donohue | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 2.0
Severity: Normal | Resolution:

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

Old description:

> If a Feed


> (https://docs.djangoproject.com/en/2.0/ref/contrib/syndication/) is
> configured anywhere in the project, then /admin/doc/views/
> (https://docs.djangoproject.com/en/2.0/ref/contrib/admin/admindocs/)
> crashes with AttributeError: `'GlobalFeed' object has no attribute
> '__qualname__'`
>
> The problem is that Feed is a callable object
> (https://github.com/django/django/blob/master/django/contrib/syndication/views.py#L34)
> and the documentation uses that class directly as a View
> (`path('latest/feed/', LatestEntriesFeed()),`), but admindocs assumes
> that all views are functions and it does not work properly with a
> callable object
> (https://github.com/django/django/blob/master/django/contrib/admindocs/views.py#L130).
>
> In Django 1.11 and earlier, admindocs supported callable objects on
> Python 2 by falling back to `view.__class__.__name__`, but it appears

> that the Python 3 code in admindocs has not supported this since it was

> As a work-around, `__qualname__` can be manually defined on Feed objects:
>
> {{{
> class MyFeed(Feed):
> def __init__(self):
> super().__init__()
> self.__qualname__ = '__call__'
> }}}
>
> Without knowing Django's opinion of the use of callable objects as views,
> I don't know the appropriate way to fix this: Should admindocs support
> callable objects as views, or should Feed not use a callable object as a
> view?

New description:

If a Feed (https://docs.djangoproject.com/en/2.0/ref/contrib/syndication/)
is configured anywhere in the project, then /admin/doc/views/
(https://docs.djangoproject.com/en/2.0/ref/contrib/admin/admindocs/)
crashes with AttributeError: `'GlobalFeed' object has no attribute
'__qualname__'`

The problem is that Feed is a callable object
(https://github.com/django/django/blob/master/django/contrib/syndication/views.py#L34)
and the documentation uses that class directly as a View
(`path('latest/feed/', LatestEntriesFeed()),`), but admindocs assumes that
all views are functions and it does not work properly with a callable
object
(https://github.com/django/django/blob/master/django/contrib/admindocs/views.py#L130).

In Django 1.11 and earlier, admindocs supported callable objects on Python

2 because it used `view.__name__` instead of `view.__qualname__`, but it
appears that the Python 3 code in admindocs has not supported this since

As a work-around, `__qualname__` can be manually defined on Feed objects:

{{{
class MyFeed(Feed):
def __init__(self):
super().__init__()
self.__qualname__ = '__call__'
}}}

Without knowing Django's opinion of the use of callable objects as views,
I don't know the appropriate way to fix this: Should admindocs support
callable objects as views, or should Feed not use a callable object as a
view?

--

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

Django

unread,
Apr 6, 2018, 7:17:09 PM4/6/18
to django-...@googlegroups.com
#29296: admindocs crash if a Feed is configured
-------------------------------+--------------------------------------

Reporter: Paul Donohue | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 2.0
Severity: Normal | Resolution:

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

Old description:

> If a Feed


> (https://docs.djangoproject.com/en/2.0/ref/contrib/syndication/) is
> configured anywhere in the project, then /admin/doc/views/
> (https://docs.djangoproject.com/en/2.0/ref/contrib/admin/admindocs/)
> crashes with AttributeError: `'GlobalFeed' object has no attribute
> '__qualname__'`
>
> The problem is that Feed is a callable object
> (https://github.com/django/django/blob/master/django/contrib/syndication/views.py#L34)
> and the documentation uses that class directly as a View
> (`path('latest/feed/', LatestEntriesFeed()),`), but admindocs assumes
> that all views are functions and it does not work properly with a
> callable object
> (https://github.com/django/django/blob/master/django/contrib/admindocs/views.py#L130).
>
> In Django 1.11 and earlier, admindocs supported callable objects on

> Python 2 because it used `view.__name__` instead of `view.__qualname__`,
> but it appears that the Python 3 code in admindocs has not supported this

> As a work-around, `__qualname__` can be manually defined on Feed objects:
>
> {{{
> class MyFeed(Feed):
> def __init__(self):
> super().__init__()
> self.__qualname__ = '__call__'
> }}}
>
> Without knowing Django's opinion of the use of callable objects as views,
> I don't know the appropriate way to fix this: Should admindocs support
> callable objects as views, or should Feed not use a callable object as a
> view?

New description:

If a Feed (https://docs.djangoproject.com/en/2.0/ref/contrib/syndication/)
is configured anywhere in the project, then /admin/doc/views/
(https://docs.djangoproject.com/en/2.0/ref/contrib/admin/admindocs/)
crashes with AttributeError: `'GlobalFeed' object has no attribute
'__qualname__'`

The problem is that Feed is a callable object
(https://github.com/django/django/blob/master/django/contrib/syndication/views.py#L34)
and the documentation uses that class directly as a View
(`path('latest/feed/', LatestEntriesFeed()),`), but admindocs assumes that
all views are functions and it does not work properly with a callable
object
(https://github.com/django/django/blob/master/django/contrib/admindocs/views.py#L130).

In Django 1.11 and earlier, admindocs supported callable objects on Python

2 because it fell back to `view.__class__.__name__`, but it appears that

As a work-around, `__qualname__` can be manually defined on Feed objects:

{{{
class MyFeed(Feed):
def __init__(self):
super().__init__()

self.__qualname__ = self.__class__.__name__
}}}

Without knowing Django's opinion of the use of callable objects as views,
I don't know the appropriate way to fix this: Should admindocs support
callable objects as views, or should Feed not use a callable object as a
view?

--

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

Django

unread,
Apr 7, 2018, 2:27:58 PM4/7/18
to django-...@googlegroups.com
#29296: admindocs ViewIndexView crashes if a syndication Feed (or something without
__qualname__) is configured
-----------------------------------+------------------------------------

Reporter: Paul Donohue | Owner: nobody
Type: Bug | Status: new
Component: contrib.admindocs | Version: 2.0
Severity: Normal | 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 Tim Graham):

* component: Uncategorized => contrib.admindocs
* type: Uncategorized => Bug
* stage: Unreviewed => Accepted


Comment:

I think admindocs must be changed not to assume `__qualname__` since I
don't think sitemaps could be changed without being backwards
incompatible.

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

Django

unread,
Apr 12, 2018, 9:54:29 AM4/12/18
to django-...@googlegroups.com
#29296: admindocs ViewIndexView crashes if a syndication Feed (or something without
__qualname__) is configured
-----------------------------------+------------------------------------
Reporter: Paul Donohue | Owner: nobody
Type: Bug | Status: new
Component: contrib.admindocs | Version: 2.0
Severity: Normal | 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 Carlton Gibson):

* has_patch: 0 => 1


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

Django

unread,
Apr 12, 2018, 10:23:04 AM4/12/18
to django-...@googlegroups.com
#29296: admindocs ViewIndexView crashes if a syndication Feed (or something without
__qualname__) is configured
-------------------------------------+-------------------------------------

Reporter: Paul Donohue | Owner: nobody
Type: Bug | Status: new
Component: contrib.admindocs | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

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

* stage: Accepted => Ready for checkin


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

Django

unread,
Apr 12, 2018, 1:34:34 PM4/12/18
to django-...@googlegroups.com
#29296: admindocs ViewIndexView crashes if a syndication Feed (or something without
__qualname__) is configured
-------------------------------------+-------------------------------------
Reporter: Paul Donohue | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admindocs | Version: 2.0
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

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


Comment:

In [changeset:"33a0b7ac815588ed92dca215e153390af8bdbdda" 33a0b7ac]:
{{{
#!CommitTicketReference repository=""
revision="33a0b7ac815588ed92dca215e153390af8bdbdda"
Fixed #29296 -- Fixed crashes in admindocs when a view is a callable
object.
}}}

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

Django

unread,
Apr 12, 2018, 1:35:56 PM4/12/18
to django-...@googlegroups.com
#29296: admindocs ViewIndexView crashes if a syndication Feed (or something without
__qualname__) is configured
-------------------------------------+-------------------------------------
Reporter: Paul Donohue | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admindocs | Version: 2.0
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"1ed31efb8753f6c4fd263033ddebc2f008e43a68" 1ed31efb]:
{{{
#!CommitTicketReference repository=""
revision="1ed31efb8753f6c4fd263033ddebc2f008e43a68"
[2.0.x] Fixed #29296 -- Fixed crashes in admindocs when a view is a
callable object.

Backport of 33a0b7ac815588ed92dca215e153390af8bdbdda from master
}}}

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

Django

unread,
Apr 12, 2018, 1:39:59 PM4/12/18
to django-...@googlegroups.com
#29296: admindocs ViewIndexView crashes if a syndication Feed (or something without
__qualname__) is configured
-------------------------------------+-------------------------------------
Reporter: Paul Donohue | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admindocs | Version: 2.0
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"979253fce9c0bb6ee484a5a786d477a47545d972" 979253f]:
{{{
#!CommitTicketReference repository=""
revision="979253fce9c0bb6ee484a5a786d477a47545d972"
[1.11.x] Fixed #29296 -- Fixed crashes in admindocs when a view is a
callable object.

Backport of 33a0b7ac815588ed92dca215e153390af8bdbdda from master
}}}

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

Reply all
Reply to author
Forward
0 new messages