Changeset - 61476fdb5c9f
[Not reviewed]
0 1 0
Bradley Kuhn (bkuhn) - 10 years ago 2014-07-14 15:03:54
bkuhn@ebb.org
First attempt to follow Django 1.4 feed classes.

I followed the instructions at
https://docs.djangoproject.com/en/1.4/ref/contrib/syndication/
and attempted to get these feeds to match that one.
1 file changed with 17 insertions and 0 deletions:
0 comments (0 inline, 0 general)
www/conservancy/feeds.py
Show inline comments
...
 
@@ -39,12 +39,17 @@ class PressReleaseFeed(Feed):
 
    link = "/news/"
 
    description = ""
 

	
 
    def items(self):
 
        return PressRelease.objects.filter(pub_date__lte=datetime.now(),
 
                                           sites__id__exact=settings.SITE_ID).order_by('-pub_date')[:10]
 
    def item_title(self, item):
 
        return item.title
 

	
 
    def item_description(self, item):
 
        return item.title
 

	
 
    def item_pubdate(self, item):
 
        return item.pub_date
 

	
 
class OmnibusFeedType(Rss201rev2Feed):
 
    def root_attributes(self):
...
 
@@ -73,12 +78,18 @@ class OmnibusFeed(ConservancyFeedBase):
 
    title_template = "feeds/omnibus_title.html"
 
    description_template = "feeds/omnibus_description.html"
 
    author_email = "info@sfconservancy.org"
 
    author_link = "https://sfconservancy.org/"
 
    author_name = "Software Freedom Conservancy"
 

	
 
    def item_title(self, item):
 
        return item.title
 

	
 
    def item_description(self, item):
 
        return item.description
 

	
 
    def item_enclosure_mime_type(self): return "audio/mpeg"
 

	
 
    def item_enclosure_url(self, item):
 
        if hasattr(item, 'mp3_path'):
 
            return "https://sfconservancy.org" + item.mp3_path
 
    def item_enclosure_length(self, item):
...
 
@@ -196,12 +207,18 @@ class BlogFeed(ConservancyFeedBase):
 
        else:
 
            answer = "All blogs at the Software Freedom Conservancy"
 
        answer += "."
 

	
 
        return answer
 
        
 
    def item_title(self, item):
 
        return item.title
 

	
 
    def item_description(self, item):
 
        return item.description
 

	
 
    def item_author_name(self, item):
 
        return item.author.formal_name
 

	
 
    def item_author_email(self, item):
 
        GET = self.request.GET
 
        if not 'author' in GET:
0 comments (0 inline, 0 general)