Opened 18 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)

feeds.diff (689 bytes ) - added by Malcolm Tredinnick 18 years ago.
Better patch (actually works now)

Download all attachments as: .zip

Change History (14)

comment:1 by Malcolm Tredinnick, 18 years ago

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.

comment:2 by Malcolm Tredinnick, 18 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.

by Malcolm Tredinnick, 18 years ago

Attachment: feeds.diff added

Better patch (actually works now)

comment:3 by Malcolm Tredinnick, 18 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 Adrian Holovaty, 18 years ago

Resolution: wontfix
Status: newclosed

Echoing mtredinnick's previous comment, I'm not sure this is needed. Why would the feed_url need to be dynamic?

comment:5 by James Bennett, 18 years ago

Resolution: wontfix
Status: closedreopened

#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:6 by Adrian Holovaty, 18 years ago

Resolution: fixed
Status: reopenedclosed

Fixed in [3409].

comment:7 by benoit Chesneau <bchesneau@…>, 18 years ago

Needs tests: set

This bug is still here today. Trunk #4347 .

comment:8 by mir@…, 18 years ago

Hmm, how can this bug be reproduced?

comment:9 by anonymous, 18 years ago

i just install last django trunk. When I click on rss link it create an error.

comment:10 by anonymous, 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 James Bennett, 18 years ago

Resolution: fixed
Status: closedreopened

Reopening per request in #3348.

comment:12 by Chris Beaven, 18 years ago

Has patch: set
Triage Stage: UnreviewedAccepted

comment:13 by Malcolm Tredinnick, 17 years ago

Resolution: fixed
Status: reopenedclosed

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.

Note: See TracTickets for help on using tickets.
Back to Top