Revision 151e729e snf-pithos-app/pithos/api/util.py

b/snf-pithos-app/pithos/api/util.py
1131 1131

  
1132 1132
                # Add a PithosBackend as attribute of the request object
1133 1133
                request.backend = get_backend(backend_cls)
1134
                request.backend.pre_exec(lock_container_path)
1134

  
1135
                path = strip_prefix(request.path)
1136
                assert path is not None, 'Unexpected path: %s' % request.path
1137
                if request.method in ('HEAD', 'GET'):
1138
                    action = 'read'
1139
                else:
1140
                    action = 'write'
1141

  
1142
                try:
1143
                    request.backend.pre_exec(
1144
                        request.user_uniq,
1145
                        *path.split('/', 2),
1146
                        action=action,
1147
                        lock_container_path=lock_container_path)
1148
                except NotAllowedError:
1149
                    if _public_request:
1150
                        raise faults.ItemNotFound('Object does not exist')
1151
                    raise faults.Forbidden('Not allowed')
1152
                except ItemNotExists:
1153
                    raise faults.ItemNotFound('Container does not exist')
1135 1154

  
1136 1155
                path = strip_prefix(request.path)
1137 1156
                assert path is not None, 'Unexpected path: %s' % request.path

Also available in: Unified diff