Opened 19 years ago
Closed 17 years ago
#1961 closed defect (fixed)
Feeds framework assumes feed link is a string
Reported by: | James Bennett | Owned by: | Adrian Holovaty |
---|---|---|---|
Component: | contrib.syndication | Version: | dev |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When checking whether the link URL for a feed contains the domain name and 'http://' prefix, django/contrib/syndication/feeds.py assumes that it's been passed a string, when it may in fact have been passed a function which returns the URL.
Attachments (1)
Change History (14)
comment:1 by , 19 years ago
comment:2 by , 19 years ago
That patch is just hosed. Do not use. Except for mocking. I'll write a more correct version later this evening or else revive ubernostrum's patch.
comment:3 by , 19 years ago
OK, here's a patch that does the same thing (treats feed_url) as a dynamic entity. I don't want to commit it yet, though, since I'm not entirely sure why it's needed. Currently feed_url is set to the full path of the feed requestand is used for the rel="self" link in the feed header. This is what the Atom spec recommends, for example. Why is this not enough?
comment:4 by , 18 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Echoing mtredinnick's previous comment, I'm not sure this is needed. Why would the feed_url need to be dynamic?
comment:5 by , 18 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
#2218 was a duplicate of this.
Adrian, the problem here is with dynamically-generated things like per-category feeds; the URL string isn't known in advance, so it's necessary to have a function which returns the correct URL.
Also, the official docs for django.contrib.syndication advocate this in the "complex example", so we ought to make sure it works :)
comment:9 by , 18 years ago
i just install last django trunk. When I click on rss link it create an error.
comment:10 by , 18 years ago
error is :
AttributeError at /feeds/gallery/
'NoneType' object has no attribute 'startswith'
Request Method: GET
Request URL: http://192.168.1.2:8000/feeds/gallery/
Exception Type: AttributeError
Exception Value: 'NoneType' object has no attribute 'startswith'
Exception Location: /sw/lib/python2.4/site-packages/django/contrib/syndication/feeds.py in get_feed, line 69
comment:11 by , 18 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Reopening per request in #3348.
comment:12 by , 18 years ago
Has patch: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:13 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Not sure why this is open / has been reopened. If somebody has a clear path to demonstrate a problem with the current code, reopen with an example.
oh @#$%! I somehow just nuked ubernostrum's original patch. He was patching add_domain() to call the url if it passed callable(url) testing.
/me goes to stand in the corner now.