comparison gpp/forums/feeds.py @ 177:9b63ad1f2ad2

Fixing #59, again. Django ticket 13093 was fixed allowing cache_page to work in the URLconf.
author Brian Neal <bgneal@gmail.com>
date Mon, 15 Mar 2010 03:26:38 +0000
parents b7ac381996e8
children 2a03c69792d8
comparison
equal deleted inserted replaced
176:b7ac381996e8 177:9b63ad1f2ad2
1 """This file contains the feed class for the forums application.""" 1 """This file contains the feed class for the forums application."""
2 2
3 from django.contrib.syndication.views import Feed 3 from django.contrib.syndication.views import Feed
4 from django.core.exceptions import ObjectDoesNotExist 4 from django.core.exceptions import ObjectDoesNotExist
5 from django.shortcuts import get_object_or_404 5 from django.shortcuts import get_object_or_404
6 from django.utils.decorators import method_decorator
7 from django.views.decorators.cache import cache_page
8 6
9 from forums.models import Forum 7 from forums.models import Forum
10 from forums.models import Post 8 from forums.models import Post
11 from core.functions import copyright_str 9 from core.functions import copyright_str
12 10
15 """The Feed class for a specific forum""" 13 """The Feed class for a specific forum"""
16 14
17 ttl = '720' 15 ttl = '720'
18 author_name = 'Brian Neal' 16 author_name = 'Brian Neal'
19 author_email = 'admin@surfguitar101.com' 17 author_email = 'admin@surfguitar101.com'
20
21 @method_decorator(cache_page(15 * 60))
22 def __call__(self, request, *args, **kwargs):
23 return super(ForumsFeed, self).__call__(request, *args, **kwargs)
24 18
25 def get_object(self, request, forum_slug): 19 def get_object(self, request, forum_slug):
26 # only return public forums 20 # only return public forums
27 if forum_slug: 21 if forum_slug:
28 forum = get_object_or_404(Forum, slug=forum_slug) 22 forum = get_object_or_404(Forum, slug=forum_slug)