The more I think about this, the more I think the feed design could be
improved.

For example - what is the purpose of the get_object() method call?

Why not get the feed class creator to implement a constructor, then
pass the information to that? In that way you don't need to mess about
with one or two argument versions of each of the data retrieval
methods: each retrieval method has access to self, after all.

Also, why is the output feed type part of the feed class? Wouldn't it
be better in most cases to allow a feed class to output to any feed
type? Okay in some cases you need specific feeds for specific outputs
(Atom vs RSS, for example), but in most cases you want one feed class
output in any format. Currently adding new formats is a bit of a faff,
but it could be made easier.

Anyway - just riffing. Recently lots of the training I've been
delivering has been to companies who are very interested in putting
feeds on everything and even loading and aggregating feeds.

Ian.

On Aug 11, 5:29 am, sago <[EMAIL PROTECTED]> wrote:
> 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 django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to