Django

Code

Ticket #1961 (closed: fixed)

Opened 3 years ago

Last modified 1 year ago

Feeds framework assumes feed link is a string

Reported by: ubernostrum Assigned to: adrian
Milestone: Component: RSS framework
Version: SVN Keywords:
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 1 Patch needs improvement: 0

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

feeds.diff (0.7 kB) - added by mtredinnick on 05/22/06 22:32:51.
Better patch (actually works now)

Change History

05/22/06 03:33:25 changed by mtredinnick

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.

05/22/06 03:42:40 changed by mtredinnick

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.

05/22/06 22:32:51 changed by mtredinnick

  • attachment feeds.diff added.

Better patch (actually works now)

05/22/06 22:36:01 changed by mtredinnick

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?

06/01/06 23:57:11 changed by adrian

  • status changed from new to closed.
  • resolution set to wontfix.

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

06/23/06 03:45:22 changed by ubernostrum

  • status changed from closed to reopened.
  • resolution deleted.

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

07/21/06 11:00:13 changed by adrian

  • status changed from reopened to closed.
  • resolution set to fixed.

Fixed in [3409].

01/18/07 01:43:21 changed by benoit Chesneau <bchesneau@mac.com>

  • needs_tests set to 1.

This bug is still here today. Trunk #4347 .

01/18/07 02:17:44 changed by mir@noris.de

Hmm, how can this bug be reproduced?

01/21/07 10:31:45 changed by anonymous

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

01/22/07 03:42:16 changed by anonymous

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

01/22/07 14:03:26 changed by ubernostrum

  • status changed from closed to reopened.
  • resolution deleted.

Reopening per request in #3348.

01/22/07 16:45:19 changed by SmileyChris

  • has_patch set to 1.
  • stage changed from Unreviewed to Accepted.

07/15/07 23:28:52 changed by mtredinnick

  • status changed from reopened to closed.
  • resolution set to fixed.

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.


Add/Change #1961 (Feeds framework assumes feed link is a string)




Change Properties
Action