changeset 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 d51743322bb2
files gpp/forums/feeds.py gpp/news/feeds.py gpp/urls.py
diffstat 3 files changed, 4 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/gpp/forums/feeds.py	Thu Mar 11 02:34:07 2010 +0000
+++ b/gpp/forums/feeds.py	Mon Mar 15 03:26:38 2010 +0000
@@ -3,8 +3,6 @@
 from django.contrib.syndication.views import Feed
 from django.core.exceptions import ObjectDoesNotExist
 from django.shortcuts import get_object_or_404
-from django.utils.decorators import method_decorator
-from django.views.decorators.cache import cache_page
 
 from forums.models import Forum
 from forums.models import Post
@@ -18,10 +16,6 @@
     author_name = 'Brian Neal'
     author_email = 'admin@surfguitar101.com'
 
-    @method_decorator(cache_page(15 * 60))
-    def __call__(self, request, *args, **kwargs):
-        return super(ForumsFeed, self).__call__(request, *args, **kwargs)
-
     def get_object(self, request, forum_slug):
         # only return public forums
         if forum_slug:
--- a/gpp/news/feeds.py	Thu Mar 11 02:34:07 2010 +0000
+++ b/gpp/news/feeds.py	Mon Mar 15 03:26:38 2010 +0000
@@ -2,8 +2,6 @@
 This file contains the feed classes for the news application.
 """
 from django.contrib.syndication.views import Feed
-from django.utils.decorators import method_decorator
-from django.views.decorators.cache import cache_page
 
 from news.models import Story
 from core.functions import get_full_name
@@ -20,10 +18,6 @@
     author_name = 'Brian Neal'
     author_email = 'admin@surfguitar101.com'
 
-    @method_decorator(cache_page(4 * 60 * 60))
-    def __call__(self, request, *args, **kwargs):
-        return super(LatestNewsFeed, self).__call__(request, *args, **kwargs)
-
     def feed_copyright(self):
         return copyright_str()
     
--- a/gpp/urls.py	Thu Mar 11 02:34:07 2010 +0000
+++ b/gpp/urls.py	Mon Mar 15 03:26:38 2010 +0000
@@ -1,6 +1,7 @@
 from django.conf.urls.defaults import *
 from django.conf import settings
 from django.contrib import admin
+from django.views.decorators.cache import cache_page
 
 from news.feeds import LatestNewsFeed
 from forums.feeds import ForumsFeed
@@ -20,14 +21,14 @@
    (r'^donations/', include('donations.urls')),
    (r'^downloads/', include('downloads.urls')),
    url(r'^feeds/news/$',
-       LatestNewsFeed(),
+       cache_page(LatestNewsFeed(), 6 * 60 * 60),
        name='feeds-news'),
    url(r'^feeds/forums/$',
-       ForumsFeed(),
+       cache_page(ForumsFeed(), 1 * 60 * 60),
        {'forum_slug': None},
        'feeds-forum_combined'),
    url(r'^feeds/forums/(?P<forum_slug>[\w\d-]+)/$',
-       ForumsFeed(),
+       cache_page(ForumsFeed(), 1 * 60 * 60),
        name='feeds-forum'),
    (r'^forums/', include('forums.urls')),
    (r'^irc/', include('irc.urls')),