Django

Code

Ticket #5855 (closed: fixed)

Opened 8 months ago

Last modified 4 months ago

Parameterized feeds have incorrect 404 behavior

Reported by: niran@niran.org Assigned to: nobody
Milestone: Component: RSS framework
Version: SVN Keywords:
Cc: Triage Stage: Design decision needed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

When using the syndication framework to generate parameterized feeds as described in the documentation, leaving off the parameter from the URL causes an exception to be raised in the Feed's link() function.

For example, if I'm trying to generate per-tag feeds for a blog at /feeds/tags/TAG_NAME, /feeds/tags/ will cause an AttributeError in my Feed subclass' link() function because the object passed to it is None. My proposed solution, which seems to work for me, is instead of checking the contents of url in get_feed(), we should check if the Feed class (self) has a get_object function, since from what I understand, any Feed subclass with a get_object() function is intended to generate a parameterized feed.

With my patch applied, /feeds/tags/ results in a 404, which seems like the appropriate behavior to me.

Attachments

patch-5855.diff (0.7 kB) - added by niran@niran.org on 11/01/07 07:34:36.
patch
patch-5855-2.diff (1.0 kB) - added by Niran Babalola <niran@niran.org> on 11/29/07 13:53:27.
revised patch

Change History

11/01/07 07:34:36 changed by niran@niran.org

  • attachment patch-5855.diff added.

patch

11/02/07 23:31:41 changed by Simon G <dev@simon.net.nz>

  • needs_better_patch changed.
  • stage changed from Unreviewed to Ready for checkin.
  • needs_tests changed.
  • needs_docs changed.

11/29/07 11:35:44 changed by mtredinnick

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

This change in behaviour isn't a good idea. It would prevent having feeds that handle both parameterised and non-parameterised versions, as we currently permit (and as I'm using in code of my own, so I know it's possible).

I will update the example documentation to have better error handling, though.

11/29/07 13:53:05 changed by Niran Babalola <niran@niran.org>

  • status changed from closed to reopened.
  • resolution deleted.
  • stage changed from Ready for checkin to Unreviewed.

Okay, here's a cleaner patch that maintains the ability to handle both parameterized and non-parameterized feeds in the same class.

11/29/07 13:53:27 changed by Niran Babalola <niran@niran.org>

  • attachment patch-5855-2.diff added.

revised patch

11/29/07 14:12:49 changed by mtredinnick

Yes, this might be a reasonably approach. I want to think about it a bit to see if there are any drawbacks, but it might well work.

03/17/08 10:52:52 changed by MichaelBishop

  • stage changed from Unreviewed to Design decision needed.

Design decision needed. Are there any drawbacks to this approach?

03/18/08 10:40:28 changed by mtredinnick

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

(In [7295]) Added more robust processing to parameterised syndication feeds for the case when all the "extra" URL bits are accidentally omitted. Patch from Niran Babalola <niran@niran.org>. Fixed #5855.

03/20/08 01:35:53 changed by mtredinnick

(In [7328]) Merged the tests and documentation from #4720 to support the changes in [7295]. Thanks, Andy Gayton. Fixed #4720. Refs #5855.


Add/Change #5855 (Parameterized feeds have incorrect 404 behavior)




Change Properties
Action