Revision 2715ade4 snf-pithos-app/pithos/api/faults.py

b/snf-pithos-app/pithos/api/faults.py
1 1
# Copyright 2011-2012 GRNET S.A. All rights reserved.
2
# 
2
#
3 3
# Redistribution and use in source and binary forms, with or
4 4
# without modification, are permitted provided that the following
5 5
# conditions are met:
6
# 
6
#
7 7
#   1. Redistributions of source code must retain the above
8 8
#      copyright notice, this list of conditions and the following
9 9
#      disclaimer.
10
# 
10
#
11 11
#   2. Redistributions in binary form must reproduce the above
12 12
#      copyright notice, this list of conditions and the following
13 13
#      disclaimer in the documentation and/or other materials
14 14
#      provided with the distribution.
15
# 
15
#
16 16
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17 17
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 18
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
......
25 25
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26 26
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 27
# POSSIBILITY OF SUCH DAMAGE.
28
# 
28
#
29 29
# The views and conclusions contained in the software and
30 30
# documentation are those of the authors and should not be
31 31
# interpreted as representing official policies, either expressed
32 32
# or implied, of GRNET S.A.
33 33

  
34

  
34 35
def camelCase(s):
35 36
    return s[0].lower() + s[1:]
36 37

  
......
42 43
        self.details = details
43 44
        self.name = name or camelCase(self.__class__.__name__)
44 45

  
46

  
45 47
class NotModified(Fault):
46 48
    code = 304
47 49

  
50

  
48 51
class BadRequest(Fault):
49 52
    code = 400
50 53

  
54

  
51 55
class Unauthorized(Fault):
52 56
    code = 401
53 57

  
58

  
54 59
class Forbidden(Fault):
55 60
    code = 403
56 61

  
62

  
57 63
class ItemNotFound(Fault):
58 64
    code = 404
59 65

  
66

  
60 67
class Conflict(Fault):
61 68
    code = 409
62 69

  
70

  
63 71
class LengthRequired(Fault):
64 72
    code = 411
65 73

  
74

  
66 75
class PreconditionFailed(Fault):
67 76
    code = 412
68 77

  
78

  
69 79
class RequestEntityTooLarge(Fault):
70 80
    code = 413
71 81

  
82

  
72 83
class RangeNotSatisfiable(Fault):
73 84
    code = 416
74 85

  
86

  
75 87
class UnprocessableEntity(Fault):
76 88
    code = 422
77 89

  
90

  
78 91
class InternalServerError(Fault):
79 92
    code = 500
80 93

  
94

  
81 95
class NotImplemented(Fault):
82 96
    code = 501

Also available in: Unified diff