From 91240f7518f59423b5d2fa7af87a2ae335a88971 Mon Sep 17 00:00:00 2001
From: "W. Trevor King"
Date: Wed, 21 Jul 2010 14:58:51 -0400
Subject: [PATCH] Use dropdowns (with textbox option for new tags) for tag
manipulation.
---
cookbook/server.py | 8 ++++++++
cookbook/template/recipe.html | 18 +++++++++++++++---
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/cookbook/server.py b/cookbook/server.py
index d606414..94f70f6 100644
--- a/cookbook/server.py
+++ b/cookbook/server.py
@@ -103,6 +103,14 @@ class Server (object):
def _clean_tag(self, tag):
"""Sanitize tag."""
+ if not isinstance(tag, types.StringType):
+ if len(tag) == 2 and '' in tag:
+ # User used either dropdown or textbox
+ tag.remove('')
+ tag = tag[0]
+ else:
+ # User used both dropdown and textbox
+ return None
m = self.tag_regexp.match(tag)
if m != None:
return m.group()
diff --git a/cookbook/template/recipe.html b/cookbook/template/recipe.html
index b335014..5864d23 100644
--- a/cookbook/template/recipe.html
+++ b/cookbook/template/recipe.html
@@ -28,16 +28,28 @@
{% endif %}
-
-
+ {% endif %}
{% for ingredient_block in recipe.ingredient_blocks %}
--
2.26.2