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

b/snf-pithos-app/pithos/api/functions.py
66 66

  
67 67
from pithos.backends.base import (
68 68
    NotAllowedError, QuotaError, ContainerNotEmpty, ItemNotExists,
69
    VersionNotExists, ContainerExists, InvalidHash)
69
    VersionNotExists, ContainerExists, InvalidHash, IllegalOperationError)
70 70

  
71 71
from pithos.backends.filter import parse_filters
72 72

  
......
1115 1115
            request.user_uniq, v_account, v_container, v_object, size,
1116 1116
            content_type, hashmap, checksum, 'pithos', meta, True, permissions
1117 1117
        )
1118
    except IllegalOperationError, e:
1119
        raise faults.Forbidden(e[0])
1118 1120
    except NotAllowedError:
1119 1121
        raise faults.Forbidden('Not allowed')
1120 1122
    except IndexError, e:
......
1176 1178
            request.user_uniq, v_account, v_container, v_object, file.size,
1177 1179
            file.content_type, file.hashmap, checksum, 'pithos', {}, True
1178 1180
        )
1181
    except IllegalOperationError, e:
1182
        faults.Forbidden(e[0])
1179 1183
    except NotAllowedError:
1180 1184
        raise faults.Forbidden('Not allowed')
1181 1185
    except ItemNotExists:
......
1437 1441
                        hashmap[bi] = src_hashmap[sbi]
1438 1442
                    else:
1439 1443
                        data = request.backend.get_block(src_hashmap[sbi])
1440
                        hashmap[bi] = request.backend.update_block(
1441
                            hashmap[bi], data[:bl], 0)
1444
                        try:
1445
                            hashmap[bi] = request.backend.update_block(
1446
                                hashmap[bi], data[:bl], 0)
1447
                        except IllegalOperationError, e:
1448
                            raise faults.Forbidden(e[0])
1442 1449
                else:
1443 1450
                    hashmap.append(src_hashmap[sbi])
1444 1451
                offset += bl
......
1485 1492
            prev_meta['type'], hashmap, checksum, 'pithos', meta, replace,
1486 1493
            permissions
1487 1494
        )
1495
    except IllegalOperationError, e:
1496
        raise faults.Forbidden(e[0])
1488 1497
    except NotAllowedError:
1489 1498
        raise faults.Forbidden('Not allowed')
1490 1499
    except ItemNotExists:

Also available in: Unified diff