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.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7295 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-03-18 15:40:27 +00:00
parent 9b52f35f35
commit f0dec08c3a
2 changed files with 11 additions and 5 deletions

View File

@ -59,6 +59,7 @@ answer newbie questions, and generally made Django that much better:
Arthur <avandorp@gmail.com> Arthur <avandorp@gmail.com>
David Avsajanishvili <avsd05@gmail.com> David Avsajanishvili <avsd05@gmail.com>
axiak@mit.edu axiak@mit.edu
Niran Babalola <niran@niran.org>
Morten Bagai <m@bagai.com> Morten Bagai <m@bagai.com>
Mikaël Barbero <mikael.barbero nospam at nospam free.fr> Mikaël Barbero <mikael.barbero nospam at nospam free.fr>
Jiri Barton Jiri Barton

View File

@ -55,18 +55,23 @@ class Feed(object):
return attr() return attr()
return attr return attr
def get_object(self, bits):
return None
def get_feed(self, url=None): def get_feed(self, url=None):
""" """
Returns a feedgenerator.DefaultFeed object, fully populated, for Returns a feedgenerator.DefaultFeed object, fully populated, for
this feed. Raises FeedDoesNotExist for invalid parameters. this feed. Raises FeedDoesNotExist for invalid parameters.
""" """
if url: if url:
try: bits = url.split('/')
obj = self.get_object(url.split('/'))
except (AttributeError, ObjectDoesNotExist):
raise FeedDoesNotExist
else: else:
obj = None bits = []
try:
obj = self.get_object(bits)
except ObjectDoesNotExist:
raise FeedDoesNotExist
if Site._meta.installed: if Site._meta.installed:
current_site = Site.objects.get_current() current_site = Site.objects.get_current()