import random
import re
import types
+from urllib import urlencode
import uuid
from xml.sax import saxutils
recipe = random.choice(self.cookbook)
else:
recipe = self.cookbook.index[name]
+ tag_links = [
+ '<a href="./?%s">%s</a>' % (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):
{% endif %}
{% if recipe.tags %}
<span class="detail-field-header">Tags:</span>
- <span class="detail-field-contents">{{ ', '.join(recipe.tags) }}
+ <span class="detail-field-contents">{{ ', '.join(tag_links) }}
</span><br/>
{% endif %}
</p>