diff --git a/scribeengine/controllers/feed.py b/scribeengine/controllers/feed.py index 7eb96c7..d11250c 100644 --- a/scribeengine/controllers/feed.py +++ b/scribeengine/controllers/feed.py @@ -1,4 +1,6 @@ import logging +import uuid +import re from feedformatter import Feed import time @@ -14,7 +16,8 @@ class FeedController(BaseController): def _generate_feed(self): blog_title = Session.query(Variable).get(u'blog title').value blog_slogan = Session.query(Variable).get(u'blog slogan').value - blog_link = request.environ[u'HTTP_HOST'] + blog_link = str('%s://%s' % (request.environ[u'wsgi.url_scheme'], \ + request.environ[u'HTTP_HOST'])) if blog_link.endswith(u'/'): blog_link = blog_link[:-1] posts = Session.query(Post)\ @@ -34,15 +37,15 @@ class FeedController(BaseController): item[u'title'] = post.title item[u'link'] = blog_link + h.url_for_post(post) item[u'author'] = post.user.nick - item[u'description'] = post.body + item[u'description'] = re.sub(r'<(.*?)>', u'', h.teaser(post.body)) item[u'pubDate'] = post.created.timetuple() - #item[u'guid'] = "1234567890" + item[u'guid'] = str(uuid.uuid5(uuid.NAMESPACE_URL, blog_link + h.url_for_post(post))) # Add item to feed feed.items.append(item) return feed def index(self): - h.redirect_to('/') + h.redirect_to(h.url_for(action=u'atom')) def rss(self, id=u'2.0'): feed = self._generate_feed() diff --git a/scribeengine/lib/base.py b/scribeengine/lib/base.py index d4fe506..339b356 100644 --- a/scribeengine/lib/base.py +++ b/scribeengine/lib/base.py @@ -49,7 +49,6 @@ log = logging.getLogger(__name__) class BaseController(WSGIController): def __before__(self): - #c.theme_name = Session.query(Configuration).get(u'theme').value if session.get(u'REMOTE_USER'): c.current_user = Session.query(User).get(session[u'REMOTE_USER']) c.blog_title = Session.query(Variable).get(u'blog title').value diff --git a/scribeengine/lib/helpers.py b/scribeengine/lib/helpers.py index ca64222..d020ee9 100644 --- a/scribeengine/lib/helpers.py +++ b/scribeengine/lib/helpers.py @@ -61,7 +61,7 @@ class Flash(object): return message_type -def teaser(text, url): +def teaser(text): position = text.find(u'

') if position > 0: return text[:position + 4] diff --git a/scribeengine/templates/base.mako b/scribeengine/templates/base.mako index f6f63f8..ed63f0a 100644 --- a/scribeengine/templates/base.mako +++ b/scribeengine/templates/base.mako @@ -6,6 +6,8 @@ ${c.page_title} + + % for script in c.scripts: diff --git a/scribeengine/templates/blog/index.mako b/scribeengine/templates/blog/index.mako index cb560ae..011f27a 100644 --- a/scribeengine/templates/blog/index.mako +++ b/scribeengine/templates/blog/index.mako @@ -4,7 +4,7 @@

${post.title}

- ${h.literal(h.teaser(post.body, h.url_for_post(post)))} + ${h.literal(h.teaser(post.body))}