Redirect for invalid tags too (just don't manipulate the data)
authorW. Trevor King <wking@drexel.edu>
Wed, 21 Jul 2010 18:38:02 +0000 (14:38 -0400)
committerW. Trevor King <wking@drexel.edu>
Wed, 21 Jul 2010 18:38:02 +0000 (14:38 -0400)
cookbook/server.py

index 4eda91a31b140c2081255f4e7757d69509ed6641..d60641448f45458aa2236c8a431994892dc093d8 100644 (file)
@@ -78,9 +78,7 @@ class Server (object):
         if recipe.tags == None:
             recipe.tags = []
         tag = self._clean_tag(tag)
-        if tag == None:
-            return
-        if tag not in recipe.tags:
+        if tag != None and tag not in recipe.tags:
             recipe.tags.append(tag)
             with open(recipe.path, 'w') as f:
                 recipe.save(f)
@@ -96,9 +94,7 @@ class Server (object):
         if recipe.tags == None:
             return
         tag = self._clean_tag(tag)
-        if tag == None:
-            return
-        if tag in recipe.tags:
+        if tag != None and tag in recipe.tags:
             recipe.tags.remove(tag)
             with open(recipe.path, 'w') as f:
                 recipe.save(f)