From: Marek Stępniowski Date: Mon, 20 Apr 2009 22:20:24 +0000 (+0200) Subject: Zmiana adresu URL z aktualnościami i konwertowanie adresu z unicode do str w tagu... X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/d0c863efe1e0e2b0b2d41c6482c42733a1b57df4?ds=sidebyside;hp=f05daac38bd815128ba11b77b1b40dc03d2b5fcf Zmiana adresu URL z aktualnościami i konwertowanie adresu z unicode do str w tagu latest_blog_posts. --- diff --git a/apps/catalogue/templatetags/catalogue_tags.py b/apps/catalogue/templatetags/catalogue_tags.py index 3c34e8cdd..d3f608ac9 100644 --- a/apps/catalogue/templatetags/catalogue_tags.py +++ b/apps/catalogue/templatetags/catalogue_tags.py @@ -1,4 +1,7 @@ # -*- coding: utf-8 -*- +import feedparser +import datetime + from django import template from django.template import Node, Variable from django.utils.encoding import smart_str @@ -190,12 +193,9 @@ class CatalogueURLNode(Node): @register.inclusion_tag('catalogue/latest_blog_posts.html') -def latest_blog_posts(feed_url, posts_to_show=5): - import feedparser - import datetime - +def latest_blog_posts(feed_url, posts_to_show=5): try: - feed = feedparser.parse(feed_url) + feed = feedparser.parse(str(feed_url)) posts = [] for i in range(posts_to_show): pub_date = feed['entries'][i].updated_parsed diff --git a/wolnelektury/templates/catalogue/main_page.html b/wolnelektury/templates/catalogue/main_page.html index 43a3636f7..af48f8402 100644 --- a/wolnelektury/templates/catalogue/main_page.html +++ b/wolnelektury/templates/catalogue/main_page.html @@ -253,7 +253,7 @@

Aktualności

{% cache 1800 latest-blog-posts %} - {% latest_blog_posts "http://www.nowoczesnapolska.org.pl/feed/?s=Wolne%20Lektury" %} + {% latest_blog_posts "http://www.nowoczesnapolska.org.pl/tematy/wolne-lektury/feed/" %} {% endcache %}

Zobacz nasz blog ⇒