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 or [])]
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):
print 'new'
self.cookbook.append(recipe)
self.cookbook.make_index()
+ self.cookbook.sort(key=lambda r: r.path)
elif name != recipe.name: # renamed recipe
print 'rename'
os.remove(recipe.path)