Revision bd40abfa snf-pithos-app/pithos/api/public.py

b/snf-pithos-app/pithos/api/public.py
37 37
from django.views.decorators.csrf import csrf_exempt
38 38

  
39 39
from synnefo.lib.astakos import get_user
40
from snf_django.lib.api import faults
40 41

  
41
from pithos.api.faults import (Fault, BadRequest, ItemNotFound, NotModified)
42 42
from pithos.api.util import (put_object_headers, update_manifest_meta,
43 43
                             validate_modification_preconditions,
44 44
                             validate_matching_preconditions,
......
78 78
            request.user_uniq, v_account,
79 79
            v_container, v_object)
80 80
    except:
81
        raise ItemNotFound('Object does not exist')
81
        raise faults.ItemNotFound('Object does not exist')
82 82

  
83 83
    if not public:
84
        raise ItemNotFound('Object does not exist')
84
        raise faults.ItemNotFound('Object does not exist')
85 85
    update_manifest_meta(request, v_account, meta)
86 86

  
87 87
    response = HttpResponse(status=200)
......
109 109
            request.user_uniq, v_account,
110 110
            v_container, v_object)
111 111
    except:
112
        raise ItemNotFound('Object does not exist')
112
        raise faults.ItemNotFound('Object does not exist')
113 113

  
114 114
    if not public:
115
        raise ItemNotFound('Object does not exist')
115
        raise faults.ItemNotFound('Object does not exist')
116 116
    update_manifest_meta(request, v_account, meta)
117 117

  
118 118
    # Evaluate conditions.
119 119
    validate_modification_preconditions(request, meta)
120 120
    try:
121 121
        validate_matching_preconditions(request, meta)
122
    except NotModified:
122
    except faults.NotModified:
123 123
        response = HttpResponse(status=304)
124 124
        response['ETag'] = meta['ETag']
125 125
        return response
......
134 134
                request.user_uniq, v_account,
135 135
                src_container, prefix=src_name, virtual=False)
136 136
        except:
137
            raise ItemNotFound('Object does not exist')
137
            raise faults.ItemNotFound('Object does not exist')
138 138

  
139 139
        try:
140 140
            for x in objects:
......
143 143
                sizes.append(s)
144 144
                hashmaps.append(h)
145 145
        except:
146
            raise ItemNotFound('Object does not exist')
146
            raise faults.ItemNotFound('Object does not exist')
147 147
    else:
148 148
        try:
149 149
            s, h = request.backend.get_object_hashmap(
......
152 152
            sizes.append(s)
153 153
            hashmaps.append(h)
154 154
        except:
155
            raise ItemNotFound('Object does not exist')
155
            raise faults.ItemNotFound('Object does not exist')
156 156

  
157 157
    if 'Content-Disposition' not in meta:
158 158
        name = v_object.rstrip('/').split('/')[-1]
......
165 165

  
166 166
@api_method(user_required=False)
167 167
def method_not_allowed(request, **v_args):
168
    raise ItemNotFound('Object does not exist')
168
    raise faults.ItemNotFound('Object does not exist')

Also available in: Unified diff