Revision dfa2d4ba

b/docs/pithos-api-guide.rst
196 196

  
197 197
The allowable request operations and respective return codes per level are presented in the remainder of this chapter. Common to all requests are the following return codes.
198 198

  
199
=========================  ================================
200
Return Code                Description
201
=========================  ================================
202
400 (Bad Request)          The request is invalid
203
401 (Unauthorized)         Missing or invalid token
204
403 (Forbidden)            Request not allowed
205
404 (Not Found)            The requested resource was not found
206
503 (Service Unavailable)  The request cannot be completed because of an internal error
207
=========================  ================================
199
==============================  ================================
200
Return Code                     Description
201
==============================  ================================
202
400 (Bad Request)               The request is invalid
203
401 (Unauthorized)              Missing or invalid token
204
403 (Forbidden)                 Request not allowed
205
404 (Not Found)                 The requested resource was not found
206
413 (Request Entity Too Large)  Insufficient quota to complete the request
207
503 (Service Unavailable)       The request cannot be completed because of an internal error
208
==============================  ================================
208 209

  
209 210
Top Level
210 211
^^^^^^^^^
b/snf-pithos-app/pithos/api/functions.py
494 494
    #                       itemNotFound (404),
495 495
    #                       forbidden (403),
496 496
    #                       badRequest (400)
497
    #                       requestentitytoolarge (413)
497 498

  
498 499
    until = get_int_parameter(request.GET.get('until'))
499 500

  
......
509 510
        raise ItemNotFound('Container does not exist')
510 511
    except ContainerNotEmpty:
511 512
        raise Conflict('Container is not empty')
513
    except QuotaError, e:
514
        raise RequestEntityTooLarge('Quota error: %s' % e)
512 515
    return HttpResponse(status=204)
513 516

  
514 517

  
......
866 869
    #                       itemNotFound (404),
867 870
    #                       forbidden (403),
868 871
    #                       badRequest (400)
872
    #                       requestentitytoolarge (413)
869 873

  
870 874
    # Evaluate conditions.
871 875
    if request.META.get('HTTP_IF_MATCH') or request.META.get('HTTP_IF_NONE_MATCH'):
......
1012 1016
    #                       itemNotFound (404),
1013 1017
    #                       forbidden (403),
1014 1018
    #                       badRequest (400)
1019
    #                       requestentitytoolarge (413)
1015 1020

  
1016 1021
    request.upload_handlers = [SaveToBackendHandler(request)]
1017 1022
    if 'X-Object-Data' not in request.FILES:
......
1044 1049
    #                       itemNotFound (404),
1045 1050
    #                       forbidden (403),
1046 1051
    #                       badRequest (400)
1052
    #                       requestentitytoolarge (413)
1047 1053

  
1048 1054
    dest_account = request.META.get('HTTP_DESTINATION_ACCOUNT')
1049 1055
    if not dest_account:
......
1085 1091
    #                       itemNotFound (404),
1086 1092
    #                       forbidden (403),
1087 1093
    #                       badRequest (400)
1094
    #                       requestentitytoolarge (413)
1088 1095

  
1089 1096
    dest_account = request.META.get('HTTP_DESTINATION_ACCOUNT')
1090 1097
    if not dest_account:
......
1336 1343
    #                       itemNotFound (404),
1337 1344
    #                       forbidden (403),
1338 1345
    #                       badRequest (400)
1346
    #                       requestentitytoolarge (413)
1339 1347

  
1340 1348
    until = get_int_parameter(request.GET.get('until'))
1341 1349
    delimiter = request.GET.get('delimiter')
......
1348 1356
        raise Forbidden('Not allowed')
1349 1357
    except ItemNotExists:
1350 1358
        raise ItemNotFound('Object does not exist')
1359
    except QuotaError, e:
1360
        raise RequestEntityTooLarge('Quota error: %s' % e)
1351 1361
    return HttpResponse(status=204)
1352 1362

  
1353 1363

  
b/snf-pithos-app/pithos/api/util.py
446 446
        raise ItemNotFound('Container or object does not exist')
447 447
    except ValueError:
448 448
        raise BadRequest('Invalid sharing header')
449
    except QuotaError:
450
        raise RequestEntityTooLarge('Quota exceeded')
449
    except QuotaError, e:
450
        raise RequestEntityTooLarge('Quota error: %s' % e)
451 451
    if public is not None:
452 452
        try:
453 453
            request.backend.update_object_public(request.user_uniq, dest_account, dest_container, dest_name, public)

Also available in: Unified diff