Commits

Konstantinos Metaxas committed 16ac2aa

Changed Atom to use Django's atom feed generator. Works with newer Django.

  • Participants
  • Parent commits 67512ef

Comments (0)

Files changed (1)

File apps/feed/blog_feeds.py

 
 from datetime import datetime as dt
 
-from django.contrib.syndication.feeds import Feed as RssFeed
+from django.contrib.syndication.feeds import Feed
 from django.contrib.sites.models import Site
 from django.contrib.auth.models import User
 from django.conf import settings
 from django.http import Http404
 from django.template.defaultfilters import pluralize
+from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed
 
-from atom import Feed as AtomFeed
+#from atom import Feed as AtomFeed
 
 from blog.models import Post
 from discussion.models import CommentNode
 from tagging.utils import get_tag_list
 
 
+
+class RssFeed(Feed):
+    """
+    A Feed that does Rss
+    """
+    feed_type = Rss201rev2Feed
+
+class AtomFeed(Feed):
+    """
+    A feed that automatically does Atom
+    """
+    feed_type = Atom1Feed
+
 def link(location):
     return '%s://%s%s' % (settings.SITE_PROTOCOL, Site.objects.get_current().domain, location)
 
 
 def _PostsByAuthor(Feed, type='atom'):
     class PostsByAuthor(Feed):
-        def get_object(self, bits):
+        def get_object(self,request, bits):
             if len(bits) != 1:
                 raise Http404
             else:
 
 def _PostsByTag(Feed, type='atom'):
     class PostsByTag(Feed):
-        def get_object(self, bits):
+        def get_object(self,request, bits):
             if len(bits) != 1:
                 raise Http404
             else:
     class CommentEntries(Feed):
         # If feed get extra_params, then this will be comments for particular entry,
         # else - all comments
-        def get_object(self, bits):
+        def get_object(self,request, bits):
             if len(bits) > 1:
                 raise Http404
             elif len(bits) == 1: