changeset 6:09df056fd18a

Use custom title for user feed
author Cédric Krier <ced@b2ck.com>
date Sun, 22 Feb 2015 11:14:14 +0100
parents f800e5584b03
children 3a9173c3110a
files farmhouse.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/farmhouse.py	Sun Feb 22 10:59:28 2015 +0100
+++ b/farmhouse.py	Sun Feb 22 11:14:14 2015 +0100
@@ -77,10 +77,10 @@
 @cache.cached(timeout=2 * 60 * 60)
 def user(user):
     packages = get_user_packages(user)
-    return render_atom(packages)
+    return render_atom(packages, title=user)
 
 
-def render_atom(packages):
+def render_atom(packages, title=None):
     packages = sorted(packages)
     releases = []
     for package in packages:
@@ -92,8 +92,10 @@
             for url in get_urls(predicate.name, version):
                 releases.append(Release(predicate.name, version, url))
     context = {}
-    context['title'] = ', '.join(packages) + ' Feed'
-    context['id'] = uuid.uuid5(uuid.NAMESPACE_URL, ','.join(packages)).urn
+    if not title:
+        title = ', '.join(packages)
+    context['title'] = '%s Feed' % title
+    context['id'] = uuid.uuid5(uuid.NAMESPACE_URL, title).urn
     releases.sort(key=lambda r: r.datetime, reverse=True)
     context['updated'] = releases[0].datetime if releases else datetime.now()
     context['releases'] = releases