Changeset - 2c63f6b33e4c
[Not reviewed]
0 1 0
Bradley Kuhn (bkuhn) - 10 years ago 2014-07-14 14:54:25
bkuhn@ebb.org
Try putting these settings in each class.

I am not sure what the loop was for anyway.
1 file changed with 3 insertions and 5 deletions:
0 comments (0 inline, 0 general)
www/conservancy/feeds.py
Show inline comments
...
 
@@ -29,16 +29,17 @@ class ConservancyFeedBase(Feed):
 
        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 { 'year' : year }
 

	
 
class PressReleaseFeed(Feed):
 
    get_absolute_url = '/feeds/news/'
 
    title = "Software Freedom Conservancy News"
 
    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]
 

	
...
 
@@ -59,16 +60,17 @@ class OmnibusFeedType(Rss201rev2Feed):
 

	
 
    def add_item_elements(self, handler, item):
 
        super(OmnibusFeedType, self).add_item_elements(handler, item)
 
        # Block things that don't have an enclosure from iTunes in
 
        # case someone uploads this feed there.
 
        handler.addQuickElement("itunes:block", 'Yes')
 

	
 
class OmnibusFeed(ConservancyFeedBase):
 
    get_absolute_url = '/feeds/omnibus/'
 
    feed_type = OmnibusFeedType
 
    link ="/news/"
 
    title = "The Software Freedom Conservancy"
 
    description = "An aggregated feed of all RSS content available from the Software Freedom Conservancy, including both news items and blogs."
 
    title_template = "feeds/omnibus_title.html"
 
    description_template = "feeds/omnibus_description.html"
 
    author_email = "info@sfconservancy.org"
 
    author_link = "https://sfconservancy.org/"
...
 
@@ -133,16 +135,17 @@ class OmnibusFeed(ConservancyFeedBase):
 
        return a
 

	
 

	
 
    def item_extra_kwargs(self, item):
 
        return super(OmnibusFeed, self).item_extra_kwargs(item)
 

	
 
class BlogFeed(ConservancyFeedBase):
 
    link = "/blog/"
 
    get_absolute_url = '/feeds/blog/'
 

	
 
    def title(self):
 
        answer = "The Software Freedom Conservancy Blog"
 

	
 
        GET = self.request.GET
 
        tags = []
 
        if 'author' in GET:
 
            tags = GET.getlist('author')
...
 
@@ -233,19 +236,14 @@ class BlogFeed(ConservancyFeedBase):
 

	
 
        if 'tag' in GET:
 
            tags = GET.getlist('tag')
 
            queryset = queryset.filter(OR_filter('tags', 'slug', tags))
 

	
 
        return queryset.order_by('-pub_date')[:10]
 

	
 

	
 

	
 
BlogFeed.get_absolute_url = '/feeds/blog/'
 
PressRelease.get_absolute_url = '/feeds/news/'
 
OmnibusFeed.get_absolute_url = '/feeds/omnibus/'
 

	
 
def view(request):
 
    """Listing of all available feeds
 
    """
 

	
 
    feeds = feed_dict.values()
 
    return render_to_response("feeds.html", {'feeds': feeds})
0 comments (0 inline, 0 general)