1. Stefan Scherfke
  2. django-weblog

Commits

Stefan Scherfke  committed 3d4d534

Fixed feeds.

  • Participants
  • Parent commits a077d39
  • Branches default

Comments (0)

Files changed (1)

File weblog/feeds.py

View file
 News feeds for the weblog app.
 
 """
-from django.core.exceptions import ObjectDoesNotExist
 from django.contrib.comments.models import Comment
 from django.contrib.sites.models import Site
 from django.contrib.syndication.views import Feed, FeedDoesNotExist
 class CategoryPosts(BaseFeed):
     """All posts in a category."""
 
-    def get_object(self, bits):
-        if len(bits) == 0:
-            raise ObjectDoesNotExist
+    def get_object(self, request, path):
+        # if len(bits) == 0:
+        #     raise ObjectDoesNotExist
 
-        path = '/'.join(bits) + '/'
+        # path = '/'.join(bits) + '/'
         return Category.objects.get(path__exact=path)
 
     def title(self, category):
     title_template = 'feeds/comment_title.html'
     description_template = 'feeds/comment_description.html'
 
-    def get_object(self, bits):
-        if len(bits) != 4:
-            raise ObjectDoesNotExist
-        try:
-            year, month, day = map(int, bits[0:3])
-            slug = bits[3]
-        except ValueError:
-            raise ObjectDoesNotExist
-        return Post.published.by_date_and_slug(year, month, day, slug)
+    def get_object(self, request, year, month, day, slug):
+        # if len(bits) != 4:
+        #     raise ObjectDoesNotExist
+        # try:
+        #     year, month, day = map(int, bits[0:3])
+        #     slug = bits[3]
+        # except ValueError:
+        #     raise ObjectDoesNotExist
+        return Post.published.by_date_and_slug(int(year), int(month), int(day),
+                                               slug)
 
     def title(self, post):
         return super(PostComments, self).title + (u' » Comments » ' +