{{{
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.
* 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>
* owner: nobody => coldmin
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/22078#comment:2>
Comment (by coldmin):
I reproduced it. I'm working now on fix.
--
Ticket URL: <https://code.djangoproject.com/ticket/22078#comment:3>
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>
* owner: coldmin => coldmind
--
Ticket URL: <https://code.djangoproject.com/ticket/22078#comment:5>
* owner: coldmin => (none)
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/22078#comment:5>
* owner: (none) => Marcelo Galigniana
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/22078#comment:6>
* 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>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/22078#comment:8>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/22078#comment:9>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/22078#comment:10>
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>
* needs_tests: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/22078#comment:12>
* needs_better_patch: 1 => 0
* needs_tests: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/22078#comment:13>
* needs_better_patch: 0 => 1
* needs_tests: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/22078#comment:14>
* needs_better_patch: 1 => 0
* needs_tests: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/22078#comment:15>
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>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/22078#comment:17>
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>
* 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>
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>