Revision 55c75058

b/Changelog
18 18
- Disallow moving deleted objects by version [#3737]
19 19
    This operation was implemented by accident, due to the symetry between
20 20
    move and copy
21
- Add optional output for file methods [#3756, #3732]:
22
    mkdir, touch, create, move, create, copy, move
21 23

  
22 24
Features:
23 25

  
......
35 37
- Add a download_to_string method in pithos client [#3608]
36 38
- Add an upload_from_string method in pithos client [#3608]
37 39
- Add pithos client method create_container [#3756]
38
- Add output for file methods [#3756, #3732]:
39
    mkdir, touch, create
40 40

  
b/kamaki/cli/commands/pithos.py
727 727
            default=''),
728 728
        source_version=ValueArgument(
729 729
            'copy specific version',
730
            ('-S', '--source-version'))
730
            ('-S', '--source-version')),
731
        with_output=FlagArgument('show request headers', ('--with-output')),
732
        json_output=FlagArgument('show headers in json', ('-j', '--json'))
731 733
    )
732 734

  
733 735
    @errors.generic.all
......
741 743
        for src_obj, dst_obj in self.src_dst_pairs(
742 744
                dst_path, self['source_version']):
743 745
            no_source_object = False
744
            self.dst_client.copy_object(
746
            r = self.dst_client.copy_object(
745 747
                src_container=self.client.container,
746 748
                src_object=src_obj,
747 749
                dst_container=self.dst_client.container,
......
754 756
            raiseCLIError('No object %s in container %s' % (
755 757
                self.path,
756 758
                self.container))
759
        if self['json_output']:
760
            print_json(r)
761
        elif self['with_output']:
762
            print_dict(r)
763

  
757 764

  
758 765
    def main(
759 766
            self, source_container___path,
......
815 822
        suffix_replace=ValueArgument(
816 823
            'Suffix of src to replace with add_suffix, if matched',
817 824
            '--suffix-to-replace',
818
            default='')
825
            default=''),
826
        with_output=FlagArgument('show request headers', ('--with-output')),
827
        json_output=FlagArgument('show headers in json', ('-j', '--json'))
819 828
    )
820 829

  
821 830
    @errors.generic.all
......
827 836
            self['destination_account']) else None
828 837
        for src_obj, dst_obj in self.src_dst_pairs(dst_path):
829 838
            no_source_object = False
830
            self.dst_client.move_object(
839
            r = self.dst_client.move_object(
831 840
                src_container=self.container,
832 841
                src_object=src_obj,
833 842
                dst_container=self.dst_client.container,
834 843
                dst_object=dst_obj,
835 844
                source_account=src_account,
836
                source_version=self['source_version'],
837 845
                public=self['public'],
838 846
                content_type=self['content_type'])
839 847
        if no_source_object:
840 848
            raiseCLIError('No object %s in container %s' % (
841 849
                self.path,
842 850
                self.container))
851
        if self['json_output']:
852
            print_json(r)
853
        elif self['with_output']:
854
            print_dict(r)
843 855

  
844 856
    def main(
845 857
            self, source_container___path,
b/kamaki/clients/pithos/__init__.py
1363 1363
        :param content_type: (str)
1364 1364

  
1365 1365
        :param delimiter: (str)
1366

  
1367
        :returns: (dict) response headers
1366 1368
        """
1367 1369
        self._assert_account()
1368 1370
        self.container = dst_container
1369 1371
        src_path = path4url(src_container, src_object)
1370
        self.object_put(
1372
        r = self.object_put(
1371 1373
            dst_object or src_object,
1372 1374
            success=201,
1373 1375
            copy_from=src_path,
......
1377 1379
            public=public,
1378 1380
            content_type=content_type,
1379 1381
            delimiter=delimiter)
1382
        return r.headers
1380 1383

  
1381 1384
    def move_object(
1382 1385
            self, src_container, src_object, dst_container,
......
1404 1407
        :param content_type: (str)
1405 1408

  
1406 1409
        :param delimiter: (str)
1410

  
1411
        :returns: (dict) response headers
1407 1412
        """
1408 1413
        self._assert_account()
1409 1414
        self.container = dst_container
1410 1415
        dst_object = dst_object or src_object
1411 1416
        src_path = path4url(src_container, src_object)
1412
        self.object_put(
1417
        r = self.object_put(
1413 1418
            dst_object,
1414 1419
            success=201,
1415 1420
            move_from=src_path,
......
1419 1424
            public=public,
1420 1425
            content_type=content_type,
1421 1426
            delimiter=delimiter)
1427
        return r.headers
1422 1428

  
1423 1429
    def get_sharing_accounts(self, limit=None, marker=None, *args, **kwargs):
1424 1430
        """Get accounts that share with self.account

Also available in: Unified diff