From 1f31799b6d0a30c79492c365914f07a26b14d508 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 23 Jul 2010 15:35:57 -0400 Subject: [PATCH] Hyperlink recipe tag list --- cookbook/server.py | 7 ++++++- cookbook/template/recipe.html | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cookbook/server.py b/cookbook/server.py index 99dba5e..28d1142 100644 --- a/cookbook/server.py +++ b/cookbook/server.py @@ -25,6 +25,7 @@ import os import random import re import types +from urllib import urlencode import uuid from xml.sax import saxutils @@ -82,8 +83,12 @@ class Server (object): recipe = random.choice(self.cookbook) else: recipe = self.cookbook.index[name] + tag_links = [ + '%s' % (urlencode({'tag':t}), t) + for t in recipe.tags] template = self.env.get_template('recipe.html') - return template.render(cookbook=self.cookbook, recipe=recipe) + return template.render(cookbook=self.cookbook, recipe=recipe, + tag_links=tag_links) @cherrypy.expose def add_tag(self, name, tag): diff --git a/cookbook/template/recipe.html b/cookbook/template/recipe.html index d5c0f03..ac7a90a 100644 --- a/cookbook/template/recipe.html +++ b/cookbook/template/recipe.html @@ -24,7 +24,7 @@ {% endif %} {% if recipe.tags %} Tags: - {{ ', '.join(recipe.tags) }} + {{ ', '.join(tag_links) }}
{% endif %}

-- 2.26.2