[Django] #22078: views.Feed methods cannot be decorated

9 views
Skip to first unread message

Django

unread,
Feb 17, 2014, 10:35:17 AM2/17/14
to django-...@googlegroups.com
#22078: views.Feed methods cannot be decorated
-------------------------------------+--------------------
Reporter: tyrion | Owner: nobody
Type: Bug | Status: new
Component: contrib.syndication | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+--------------------
If one applies a decorator on a method which is called by
`__get_dynamic_attr` a `TypeError` like this occurs:

{{{
Exception Type: TypeError at /blog/feed/
Exception Value: item_link() takes exactly 2 arguments (1 given)
}}}

I think this is because `__get_dynamic_attr` tries to count the function's
arguments, but decorators usally get defined with the `*args, **kwargs`
syntax, so this trick does not work here.
{{{
if code.co_argcount == 2: # one argument is 'self'
return attr(obj)
else:
return attr()
}}}

I think the best approach would be to remove one of the two methods. IMHO
We should have either `attr(item)` or `attr()` not both, as "there should
be one, and preferably only one, obvious way to do it".

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

Django

unread,
Mar 20, 2014, 3:17:33 PM3/20/14
to django-...@googlegroups.com
#22078: views.Feed methods cannot be decorated
-------------------------------------+------------------------------------

Reporter: tyrion | Owner: nobody
Type: Bug | Status: new
Component: contrib.syndication | Version: 1.6
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 aaugustin):

* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* needs_tests: => 0
* needs_docs: => 0


Comment:

Yes, that code is fragile.

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

Django

unread,
Apr 17, 2014, 7:24:18 AM4/17/14
to django-...@googlegroups.com
#22078: views.Feed methods cannot be decorated
-------------------------------------+------------------------------------
Reporter: tyrion | Owner: coldmin
Type: Bug | Status: assigned
Component: contrib.syndication | Version: 1.6

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 coldmin):

* owner: nobody => coldmin
* status: new => assigned


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

Django

unread,
Apr 17, 2014, 7:26:42 AM4/17/14
to django-...@googlegroups.com
#22078: views.Feed methods cannot be decorated
-------------------------------------+------------------------------------
Reporter: tyrion | Owner: coldmin
Type: Bug | Status: assigned
Component: contrib.syndication | Version: 1.6

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
-------------------------------------+------------------------------------

Comment (by coldmin):

I reproduced it. I'm working now on fix.

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

Django

unread,
Apr 17, 2014, 3:25:02 PM4/17/14
to django-...@googlegroups.com
#22078: views.Feed methods cannot be decorated
-------------------------------------+------------------------------------
Reporter: tyrion | Owner: coldmin
Type: Bug | Status: assigned
Component: contrib.syndication | Version: 1.6

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
-------------------------------------+------------------------------------

Comment (by coldmin):

I sended pull request.
https://github.com/django/django/pull/2584

The problem is that methods without the 'item' argument (only with self)
should be static now.
But the decorators works now (sample project is in attachments)

{{{
@staticmethod
def item_description(self):
return force_text(item)
}}}

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

Django

unread,
Apr 18, 2014, 2:15:30 AM4/18/14
to django-...@googlegroups.com
#22078: views.Feed methods cannot be decorated
-------------------------------------+------------------------------------
Reporter: tyrion | Owner: coldmind
Type: Bug | Status: assigned
Component: contrib.syndication | Version: 1.6

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 coldmind):

* owner: coldmin => coldmind


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

Django

unread,
Mar 11, 2022, 5:19:16 AM3/11/22
to django-...@googlegroups.com
#22078: views.Feed methods cannot be decorated
-------------------------------------+------------------------------------
Reporter: Germano Gabbianelli | Owner: (none)

Type: Bug | Status: new
Component: contrib.syndication | Version: 1.6
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 Mariusz Felisiak):

* owner: coldmin => (none)
* status: assigned => new

Django

unread,
May 1, 2022, 11:26:48 PM5/1/22
to django-...@googlegroups.com
#22078: views.Feed methods cannot be decorated
-------------------------------------+-------------------------------------
Reporter: Germano Gabbianelli | Owner: Marcelo
| Galigniana
Type: Bug | Status: assigned
Component: contrib.syndication | Version: 1.6

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 Marcelo Galigniana):

* owner: (none) => Marcelo Galigniana


* status: new => assigned


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

Django

unread,
May 1, 2022, 11:48:37 PM5/1/22
to django-...@googlegroups.com
#22078: views.Feed methods cannot be decorated
-------------------------------------+-------------------------------------
Reporter: Germano Gabbianelli | Owner: Marcelo
| Galigniana
Type: Bug | Status: assigned
Component: contrib.syndication | Version: 1.6

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 Marcelo Galigniana):

* has_patch: 0 => 1


Comment:

Pull Request created: [https://github.com/django/django/pull/15648 PR]

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

Django

unread,
May 2, 2022, 1:34:40 AM5/2/22
to django-...@googlegroups.com
#22078: views.Feed methods cannot be decorated
-------------------------------------+-------------------------------------
Reporter: Germano Gabbianelli | Owner: Marcelo
| Galigniana
Type: Bug | Status: assigned
Component: contrib.syndication | Version: 1.6

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

* needs_better_patch: 0 => 1


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

Django

unread,
May 5, 2022, 2:19:28 AM5/5/22
to django-...@googlegroups.com
#22078: views.Feed methods cannot be decorated
-------------------------------------+-------------------------------------
Reporter: Germano Gabbianelli | Owner: Marcelo
| Galigniana
Type: Bug | Status: assigned
Component: contrib.syndication | Version: 1.6

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 Marcelo Galigniana):

* needs_better_patch: 1 => 0


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

Django

unread,
May 20, 2022, 4:19:41 AM5/20/22
to django-...@googlegroups.com
#22078: views.Feed methods cannot be decorated
-------------------------------------+-------------------------------------
Reporter: Germano Gabbianelli | Owner: Marcelo
| Galigniana
Type: Bug | Status: assigned
Component: contrib.syndication | Version: 1.6

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

* needs_better_patch: 0 => 1


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

Django

unread,
May 23, 2022, 12:54:29 AM5/23/22
to django-...@googlegroups.com
#22078: views.Feed methods cannot be decorated
-------------------------------------+-------------------------------------
Reporter: Germano Gabbianelli | Owner: Marcelo
| Galigniana
Type: Bug | Status: assigned
Component: contrib.syndication | Version: 1.6

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

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

In [changeset:"241fe59b74bb6031fa644f3ad55e6ad6a9187510" 241fe59b]:
{{{
#!CommitTicketReference repository=""
revision="241fe59b74bb6031fa644f3ad55e6ad6a9187510"
Refs #22078 -- Added syndication test for feeds with callable objects.
}}}

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

Django

unread,
May 23, 2022, 3:12:41 AM5/23/22
to django-...@googlegroups.com
#22078: views.Feed methods cannot be decorated
-------------------------------------+-------------------------------------
Reporter: Germano Gabbianelli | Owner: Marcelo
| Galigniana
Type: Bug | Status: assigned
Component: contrib.syndication | Version: 1.6

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1

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

* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/22078#comment:12>

Django

unread,
May 24, 2022, 10:27:19 AM5/24/22
to django-...@googlegroups.com
#22078: views.Feed methods cannot be decorated
-------------------------------------+-------------------------------------
Reporter: Germano Gabbianelli | Owner: Marcelo
| Galigniana
Type: Bug | Status: assigned
Component: contrib.syndication | Version: 1.6

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 Marcelo Galigniana):

* needs_better_patch: 1 => 0

* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/22078#comment:13>

Django

unread,
May 25, 2022, 2:02:18 AM5/25/22
to django-...@googlegroups.com
#22078: views.Feed methods cannot be decorated
-------------------------------------+-------------------------------------
Reporter: Germano Gabbianelli | Owner: Marcelo
| Galigniana
Type: Bug | Status: assigned
Component: contrib.syndication | Version: 1.6

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1


* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/22078#comment:14>

Django

unread,
May 25, 2022, 10:18:51 PM5/25/22
to django-...@googlegroups.com
#22078: views.Feed methods cannot be decorated
-------------------------------------+-------------------------------------
Reporter: Germano Gabbianelli | Owner: Marcelo
| Galigniana
Type: Bug | Status: assigned
Component: contrib.syndication | Version: 1.6

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 Marcelo Galigniana):

* needs_better_patch: 1 => 0
* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/22078#comment:15>

Django

unread,
May 26, 2022, 4:05:21 AM5/26/22
to django-...@googlegroups.com
#22078: views.Feed methods cannot be decorated
-------------------------------------+-------------------------------------
Reporter: Germano Gabbianelli | Owner: Marcelo
| Galigniana
Type: Bug | Status: assigned
Component: contrib.syndication | Version: 1.6

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
-------------------------------------+-------------------------------------

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

In [changeset:"7e4656e4b2189390a433a149091442d53a777e2b" 7e4656e4]:
{{{
#!CommitTicketReference repository=""
revision="7e4656e4b2189390a433a149091442d53a777e2b"
Refs #22078 -- Added syndication test for feeds with static methods.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22078#comment:16>

Django

unread,
May 26, 2022, 4:36:36 AM5/26/22
to django-...@googlegroups.com
#22078: views.Feed methods cannot be decorated
-------------------------------------+-------------------------------------
Reporter: Germano Gabbianelli | Owner: Marcelo
| Galigniana
Type: Bug | Status: assigned
Component: contrib.syndication | Version: 1.6
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 Mariusz Felisiak):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/22078#comment:17>

Django

unread,
May 26, 2022, 5:11:42 AM5/26/22
to django-...@googlegroups.com
#22078: views.Feed methods cannot be decorated
-------------------------------------+-------------------------------------
Reporter: Germano Gabbianelli | Owner: Marcelo
| Galigniana
Type: Bug | Status: assigned
Component: contrib.syndication | Version: 1.6

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
-------------------------------------+-------------------------------------

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

In [changeset:"9d3b812001ee0457946865ef13f6192faed6bf73" 9d3b8120]:
{{{
#!CommitTicketReference repository=""
revision="9d3b812001ee0457946865ef13f6192faed6bf73"
[4.1.x] Refs #22078 -- Added syndication test for feeds with static
methods.

Backport of 7e4656e4b2189390a433a149091442d53a777e2b from main.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22078#comment:18>

Django

unread,
May 26, 2022, 5:12:13 AM5/26/22
to django-...@googlegroups.com
#22078: views.Feed methods cannot be decorated
-------------------------------------+-------------------------------------
Reporter: Germano Gabbianelli | Owner: Marcelo
| Galigniana
Type: Bug | Status: closed
Component: contrib.syndication | Version: 1.6
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 Mariusz Felisiak <felisiak.mariusz@…>):

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


Comment:

In [changeset:"8c0886b068ba4e224dd78104b93c9638b860b398" 8c0886b0]:
{{{
#!CommitTicketReference repository=""
revision="8c0886b068ba4e224dd78104b93c9638b860b398"
Fixed #22078 -- Fixed crash of Feed with decorated methods.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22078#comment:19>

Django

unread,
May 26, 2022, 5:15:18 AM5/26/22
to django-...@googlegroups.com
#22078: views.Feed methods cannot be decorated
-------------------------------------+-------------------------------------
Reporter: Germano Gabbianelli | Owner: Marcelo
| Galigniana
Type: Bug | Status: closed
Component: contrib.syndication | Version: 1.6

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 Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"0210dbcbe3ee7fc84e25efbec256adbec36ea9ff" 0210dbcb]:
{{{
#!CommitTicketReference repository=""
revision="0210dbcbe3ee7fc84e25efbec256adbec36ea9ff"
[4.1.x] Fixed #22078 -- Fixed crash of Feed with decorated methods.

Backport of 8c0886b068ba4e224dd78104b93c9638b860b398 from main.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22078#comment:20>

Reply all
Reply to author
Forward
0 new messages