Added recipe removal link and replaced ' />' -> '/>'
[cookbook.git] / cookbook / server.py
index 76dded630ff4d3dafd4c90b9fdc9c66fbf63d51a..19b3d588099f1ab694979b688b018548d2e8f39d 100644 (file)
@@ -132,7 +132,13 @@ class Server (object):
     def edit(self, name=None, **kwargs):
         """Remove a tag from a single recipe."""
         name,recipe,action = self._normalize_edit_params(name, **kwargs)
-        if action.startswith('edit'):
+        if action == 'remove':
+            recipe = self.cookbook.index[name]
+            os.remove(recipe.path)
+            self.cookbook.remove(recipe)
+            self.cookbook.make_index()
+            raise cherrypy.HTTPRedirect(u'.', status=302)
+        elif action.startswith('edit'):
             self._update_recipe(name, recipe)
             if action == 'edit and redirect':  # done editing this recipe
                 raise cherrypy.HTTPRedirect(