I was delivering some Django training this week, and it occurred to me
there is a huge DRY-violation in the Django feed system.
Django has a comprehensive and (in my opinion) superb URL routing
mechanism. You route urls to views. In many cases you can route a
number of urls to the same view, adding extra information with a
dictionary of data. Generic views work very well in this way.
But the feed system gets you to extract a whole section of the url and
feed it to the feed view. Thereafter the first part of the url is
matched against a regular dictionary to find the feed class, and any
further bits of the url are split into sections by slash and given to
get_object.
The feed approach for routing urls is everything that django's url
system was designed not to be: it imposes a hierarchical structure on
the url, distributes the configuration over multiple representations,
and could be avoided by having a feed view that behaves more like
generic views:
(r'feeds/rss/comments/(?P<slug>\w+)/',
'django.contrib.syndication.views.feed',
{'feed': LatestEntriesFeedClass}),
And removing the (imho warty) url_elements list of strings that get
passed to get_object, replacing it with any regular named groups
pulled from the url:
def feed(request, feed, *args, **kws):
feed_instance = feed()
object = feed_instance.get_object(*args, **kws)
and so on...
Am I wrong to feel this way?
Ian.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---