aboutsummaryrefslogtreecommitdiff
path: root/budget/rest.py
diff options
context:
space:
mode:
authorAlexis Metaireau <alexis@notmyidea.org>2011-10-08 13:22:18 +0200
committerAlexis Metaireau <alexis@notmyidea.org>2011-10-08 13:27:30 +0200
commit48bc551853b8b0067cdaeef98b3e454c3249f98f (patch)
tree75332a6548aba9d95e0771de2af0e9e19d53efbc /budget/rest.py
parent402dbce153639668d47db00fdc7a0479d9ebc3f6 (diff)
downloadihatemoney-mirror-48bc551853b8b0067cdaeef98b3e454c3249f98f.zip
ihatemoney-mirror-48bc551853b8b0067cdaeef98b3e454c3249f98f.tar.gz
ihatemoney-mirror-48bc551853b8b0067cdaeef98b3e454c3249f98f.tar.bz2
Complete the REST API + Tests. Fix #27
Diffstat (limited to 'budget/rest.py')
-rw-r--r--budget/rest.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/budget/rest.py b/budget/rest.py
index f237217..992a61e 100644
--- a/budget/rest.py
+++ b/budget/rest.py
@@ -90,7 +90,7 @@ def need_auth(authentifier, name=None, remove_attr=True):
If the request is authorized, the object returned by the authentifier
is added to the kwargs of the method.
- If not, issue a 403 Forbidden error
+ If not, issue a 401 Unauthorized error
:authentifier:
The callable to check the context onto.
@@ -114,7 +114,7 @@ def need_auth(authentifier, name=None, remove_attr=True):
del kwargs["%s_id" % name]
return func(*args, **kwargs)
else:
- return 403, "Forbidden"
+ return 401, "Unauthorized"
return wrapped
return wrapper
@@ -126,7 +126,7 @@ def serialize(func):
"""
def wrapped(*args, **kwargs):
# get the mimetype
- mime = request.accept_mimetypes.best_match(SERIALIZERS.keys())
+ mime = request.accept_mimetypes.best_match(SERIALIZERS.keys()) or "text/json"
data = func(*args, **kwargs)
serializer = SERIALIZERS[mime]