#5855 closed (fixed)
Parameterized feeds have incorrect 404 behavior
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | contrib.syndication | Version: | dev |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Design decision needed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
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 (2)
Change History (9)
by , 18 years ago
| Attachment: | patch-5855.diff added |
|---|
comment:1 by , 18 years ago
| Triage Stage: | Unreviewed → Ready for checkin |
|---|
comment:2 by , 18 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
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.
comment:3 by , 18 years ago
| Resolution: | wontfix |
|---|---|
| Status: | closed → reopened |
| Triage Stage: | Ready for checkin → Unreviewed |
Okay, here's a cleaner patch that maintains the ability to handle both parameterized and non-parameterized feeds in the same class.
comment:4 by , 18 years ago
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.
comment:5 by , 18 years ago
| Triage Stage: | Unreviewed → Design decision needed |
|---|
Design decision needed. Are there any drawbacks to this approach?
comment:6 by , 18 years ago
| Resolution: | → fixed |
|---|---|
| Status: | reopened → closed |
patch