Revision f9e723fd pithos/tools/pithos-sh

b/pithos/tools/pithos-sh
291 291
        parser.add_option('--versionlist', action='store_true',
292 292
                          dest='versionlist', default=False,
293 293
                          help='get the full object version list')
294
        parser.add_option('--hashmap', action='store_true',
295
                          dest='hashmap', default=False,
296
                          help='get the object hashmap instead')
294 297
    
295 298
    def execute(self, path):
296 299
        attrs = ['if_match', 'if_none_match', 'if_modified_since',
297
                 'if_unmodified_since']
300
                 'if_unmodified_since', 'hashmap']
298 301
        args = self._build_args(attrs)
299 302
        args['format'] = 'json' if self.detail else 'text'
300 303
        if self.range:
......
313 316
        elif self.version:
314 317
            data = self.client.retrieve_object_version(container, object,
315 318
                                                       self.version, **args)
319
        elif self.hashmap:
320
            if 'detail' in args.keys():
321
                args.pop('detail')
322
            args.pop('format')
323
            self.detail = True
324
            data = self.client.retrieve_object_hashmap(container, object, **args)
316 325
        else:
317 326
            data = self.client.retrieve_object(container, object, **args)    
318 327
        
319 328
        f = open(self.file, 'w') if self.file else stdout
320
        if self.detail:
329
        if self.detail or type(data) == types.DictionaryType:
321 330
            if self.versionlist:
322 331
                print_versions(data, f=f)
323 332
            else:
......
358 367
        #                  help='use for large file support')
359 368
        parser.add_option('--manifest', action='store',
360 369
                          dest='x_object_manifest', default=None,
361
                          help='upload a manifestation file')
370
                          help='provide object parts prefix in <container>/<object> form')
362 371
        parser.add_option('--content-type', action='store',
363 372
                          dest='content_type', default=None,
364 373
                          help='create object with specific content type')
......
485 494
        parser.add_option('--offset', action='store',
486 495
                          dest='offset',
487 496
                          default=None, help='starting offest to be updated')
488
        parser.add_option('--range', action='store', dest='content-range',
497
        parser.add_option('--range', action='store', dest='content_range',
489 498
                          default=None, help='range of data to be updated')
490 499
        parser.add_option('--chunked', action='store_true', dest='chunked',
491 500
                          default=False, help='set chunked transfer mode')
......
526 535
        
527 536
        
528 537
        attrs = ['content_encoding', 'content_disposition', 'x_object_sharing',
529
                 'x_object_public', 'replace']
538
                 'x_object_public', 'x_object_manifest', 'replace', 'offset',
539
                 'content_range']
530 540
        args = self._build_args(attrs)
531 541
        
532 542
        if self.no_sharing:

Also available in: Unified diff