Changeset - 85e9253eec6c
[Not reviewed]
0 1 0
Bradley Kuhn (bkuhn) - 10 years ago 2014-07-08 17:25:48
bkuhn@ebb.org
Update for Djnango 1.4.5: feeds import.
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
www/conservancy/feeds.py
Show inline comments
 
from django.contrib.syndication.feeds import Feed
 
from django.contrib.syndication.views import Feed
 
from django.utils.feedgenerator import Rss201rev2Feed 
 
from conservancy.apps.news.models import PressRelease
 
from conservancy.apps.blog.models import Entry as BlogEntry
 

	
 
from django.shortcuts import render_to_response
 
from django.conf import settings
 
from datetime import datetime
 

	
 
import itertools
 
import operator
 

	
 
class ConservancyFeedBase(Feed):
 
    def copyright_holder(self): return "Software Freedom Conservancy"
 

	
 
    def license_no_html(self): return "Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License."
 

	
 
    def item_copyright(self, item):
 
        year = 2008
 
        for attr in ('pub_date', 'date_created', 'date_last_modified'):
 
            if hasattr(item, attr):
 
                if hasattr(getattr(item, attr), 'year'):
 
                    year = getattr(getattr(item, attr), 'year')
 
                    break
 
        return 'Copyright (C) %d, %s.  %s' % (year, self.copyright_holder(), self.license_no_html())
0 comments (0 inline, 0 general)