Convert return HttpException to raise HttpException

controllers (view function) raise HttpException's and do not return them.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth
2012-12-23 11:58:51 +01:00
parent 785b287fcb
commit cfa922295e
6 changed files with 15 additions and 14 deletions

View File

@@ -142,7 +142,7 @@ def api_auth(controller):
# If we can't find any authentication methods, we should not let them
# pass.
if not auth_candidates:
return Forbidden()
raise Forbidden()
# For now, just select the first one in the list
auth = auth_candidates[0]
@@ -156,7 +156,7 @@ def api_auth(controller):
'status': 403,
'errors': auth.errors})
return Forbidden()
raise Forbidden()
return controller(request, *args, **kw)

View File

@@ -48,13 +48,13 @@ def post_entry(request):
if request.method != 'POST':
_log.debug('Must POST against post_entry')
return BadRequest()
raise BadRequest()
if not 'file' in request.files \
or not isinstance(request.files['file'], FileStorage) \
or not request.files['file'].stream:
_log.debug('File field not found')
return BadRequest()
raise BadRequest()
media_file = request.files['file']
@@ -130,7 +130,7 @@ def post_entry(request):
@api_auth
def api_test(request):
if not request.user:
return Forbidden()
raise Forbidden()
user_data = {
'username': request.user.username,