Skip to content

Commit

Permalink
tag feeds
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Golub committed Nov 15, 2008
1 parent d6f0ea4 commit 56c051e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions base.html
Expand Up @@ -9,6 +9,7 @@
<link rel="shortcut icon" href="/static/images/blog.png" type="image/png"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script>
<script src="/static/javascript/base.js" type="text/javascript"></script>
{% block extra_head %}{% endblock %}
</head>
<body>
<div id="header">
Expand Down
5 changes: 3 additions & 2 deletions main.py
Expand Up @@ -153,6 +153,9 @@ def render_feed(self, entries):


def render(self, template_file, extra_context={}):
if "entries" in extra_context and \
self.request.get('format', None) == 'atom':
return self.render_feed(extra_context["entries"])
extra_context['request'] = self.request
extra_context['admin'] = users.is_current_user_admin()
extra_context['recent_entries'] = self.get_recent_entries()
Expand Down Expand Up @@ -214,8 +217,6 @@ def get(self):
entries = db.Query(Entry).order('-published').fetch(limit=10, offset=offset)
if not entries and offset > 0:
return self.redirect('/')
if self.request.get('format', None) == 'atom':
return self.render_feed(entries)
extra_context = {
'entries': entries,
'next': max(offset - 10, 0),
Expand Down
4 changes: 4 additions & 0 deletions tag.html
Expand Up @@ -4,6 +4,10 @@
{{ tag }} -
{% endblock %}

{% block extra_head %}
<link rel="alternate" type="application/atom+xml" href="{{ request.path }}?format=atom" title="Entries tagged &quot;{{ tag }}&quot;"/>
{% endblock %}

{% block above_entries %}
<div class="infomessage">
Entries tagged <a href="/t/{{ tag }}">{{ tag }}</a>
Expand Down

0 comments on commit 56c051e

Please sign in to comment.