Revision 1e47e49d snf-pithos-app/pithos/api/util.py

b/snf-pithos-app/pithos/api/util.py
72 72
from pithos.api.resources import resources
73 73
from pithos.backends import connect_backend
74 74
from pithos.backends.base import (NotAllowedError, QuotaError, ItemNotExists,
75
                                  VersionNotExists)
75
                                  VersionNotExists, IllegalOperationError)
76 76

  
77 77
from synnefo.lib import join_urls
78 78
from synnefo.util import text
......
967 967
    bo = offset % request.backend.block_size
968 968
    bl = min(len(data), request.backend.block_size - bo)
969 969
    if bi < len(hashmap):
970
        hashmap[bi] = request.backend.update_block(hashmap[bi], data[:bl], bo)
970
        try:
971
            hashmap[bi] = request.backend.update_block(hashmap[bi],
972
                                                       data[:bl], bo)
973
        except IllegalOperationError, e:
974
            raise faults.Forbidden(e)
971 975
    else:
972 976
        hashmap.append(request.backend.put_block(('\x00' * bo) + data[:bl]))
973 977
    return bl  # Return ammount of data written.

Also available in: Unified diff