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.
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>
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
> 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?
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
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:2>
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
> 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?
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
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__ = 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>
* 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>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/29296#comment:5>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/29296#comment:6>
* 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>
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>
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>