Download:
child 19:fb40c77422c5
parent 17:53d62a88c56e
18:fc0c0cc25502
Anton Shestakov <engored@ya.ru>, Fri, 11 Jan 2013 00:27:32 +0900
Return 404 in case of RecordDeleted exception (which, apparently, is different enough from RecordNotFound).

1 файлов изменено, 4 вставок(+), 4 удалений(-) [+]
app.py file | annotate | diff | comparison | revisions
--- a/app.py Wed Jan 09 11:46:15 2013 +0900
+++ b/app.py Fri Jan 11 00:27:32 2013 +0900
@@ -5,7 +5,7 @@
from flask import Flask, g, request, render_template
from flask.ext.restful import Resource, Api
-from CodernityDB.database import RecordNotFound
+from CodernityDB.database import RecordNotFound, RecordDeleted
from CodernityDB.database_thread_safe import ThreadSafeDatabase
from fruitbar.indexes import ProjectIndex, TaskIndex
@@ -62,7 +62,7 @@
if doc['workspace'] != workspace:
raise RecordNotFound
- except RecordNotFound:
+ except (RecordNotFound, RecordDeleted):
return '', 404
return doc
@@ -73,7 +73,7 @@
if doc['workspace'] != workspace:
raise RecordNotFound
- except RecordNotFound:
+ except (RecordNotFound, RecordDeleted):
return '', 404
userdata = dict((k, v) for (k, v) in request.json.items() if k in self.safe_fields)
@@ -88,7 +88,7 @@
if doc['workspace'] != workspace:
raise RecordNotFound
- except RecordNotFound:
+ except (RecordNotFound, RecordDeleted):
return '', 404
g.db.delete(doc)