[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Maposmatic-dev] [PATCH] Remove the overhead of parsing blog entries whe
From: |
gael . utard |
Subject: |
[Maposmatic-dev] [PATCH] Remove the overhead of parsing blog entries when generating the rss feed. |
Date: |
Fri, 6 Aug 2010 16:45:05 +0200 |
From: Gaël Utard <address@hidden>
This saves a lot of CPU.
Signed-off-by: Gaël Utard <address@hidden>
---
www/maposmatic/context_processors.py | 5 +++++
www/urls.py | 2 +-
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/www/maposmatic/context_processors.py
b/www/maposmatic/context_processors.py
index 3c9fde4..b9b3348 100644
--- a/www/maposmatic/context_processors.py
+++ b/www/maposmatic/context_processors.py
@@ -22,6 +22,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from models import MapRenderingJob
+from django.core.urlresolvers import reverse
import feedparser
def get_latest_blog_posts():
@@ -29,6 +30,10 @@ def get_latest_blog_posts():
return f.entries[:5]
def all(request):
+ # Do not add the useless overhead of parsing blog entries when generating
+ # the rss feed
+ if request.path == reverse('rss-feed', args=['maps']):
+ return {}
d = {}
d['randommap'] = MapRenderingJob.objects.get_random_with_thumbnail()
d['blogposts'] = get_latest_blog_posts()
diff --git a/www/urls.py b/www/urls.py
index 9dd5da2..7977ad3 100644
--- a/www/urls.py
+++ b/www/urls.py
@@ -69,7 +69,7 @@ urlpatterns = patterns('',
# Feeds
(r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed',
- {'feed_dict': feeds}),
+ {'feed_dict': feeds}, 'rss-feed'),
# Static data
(r'^results/(?P<path>.*)$', 'django.views.static.serve',
--
1.7.0.4
- [Maposmatic-dev] [PATCH] Remove the overhead of parsing blog entries when generating the rss feed.,
gael . utard <=