Opened 8 years ago

Closed 5 years ago

#6304 closed (fixed)

Syndication feed framework should allow for parsing of URLs in the URLconf

Reported by: adrian Owned by: nobody
Component: contrib.syndication Version: master
Severity: Keywords:
Cc: floguy@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Currently, the syndication feed framework requires the developer to parse URLs manually in Feed.get_object(), which violates the DRY principle and is confusing because it leads to URL parsing being in more than one place (i.e., in a place other than the URLconf). I am proposing a new view in django.contrib.syndication.views, called single_feed(), which allows for parsing the URL in the URLconf instead of Feed.get_object().

The problem with this patch, which I realized only after implementing it, is that it couples Feed to either single_feed() or multiple_feeds(). We could change Feed.get_object() to *always* take a list of URL parameters, but that would be a backwards-incompatibility. I'm posting my patch here for discussion.

Attachments (1)

single_feed.diff (7.0 KB) - added by adrian 8 years ago.
Implementation of single_feed()

Download all attachments as: .zip

Change History (4)

Changed 8 years ago by adrian

Implementation of single_feed()

comment:1 Changed 8 years ago by floguy

  • Cc floguy@… added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

The idea of moving as much URL parsing into the URLconf as possible seems like a good one, as I've had a hard time with this before too. As long as it's here for discussion, I'd like to bring up that this is done in a few contrib apps (databrowse and newforms-admin's admin come to mind). Maybe a policy w.r.t. this practice should be decided before 1.0.

comment:2 Changed 7 years ago by jacob

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 5 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(In [12338]) Fixed #6188, #6304, #6618, #6969, #8758, #8989, #10334, #11069, #11973 and #12403 -- Modified the syndication framework to use class-based views. Thanks to Ben Firshman for his work on this patch.

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