Download:
child 4:ef90a3eaf425
parent 2:cc1e5f212e6c
3:fd68ae95de5e
Anton Shestakov <engored@ya.ru>, Tue, 25 Dec 2012 17:14:50 +0900
Move task deletion logic to TaskIndex.run_delete_for_project().

2 файлов изменено, 6 вставок(+), 2 удалений(-) [+]
app.py file | annotate | diff | comparison | revisions
fruitbar/indexes.py file | annotate | diff | comparison | revisions
--- a/app.py Tue Dec 25 17:09:32 2012 +0900
+++ b/app.py Tue Dec 25 17:14:50 2012 +0900
@@ -98,8 +98,7 @@
safe_fields = ('name', 'color')
def delete(self, resource_id):
- for task in g.db.get_many('task', resource_id, with_doc=True):
- response = g.db.delete(task['doc'])
+ g.db.run('task', 'delete_for_project', resource_id)
return super(Project, self).delete(resource_id)
--- a/fruitbar/indexes.py Tue Dec 25 17:09:32 2012 +0900
+++ b/fruitbar/indexes.py Tue Dec 25 17:14:50 2012 +0900
@@ -29,3 +29,8 @@
def make_key(self, key):
return md5(key).digest()
+
+ def run_delete_for_project(self, db, project):
+ for task in db.get_many('task', project, with_doc=True):
+ db.delete(task['doc'])
+