Revision f8426b5c kamaki/cli/commands/pithos.py

b/kamaki/cli/commands/pithos.py
40 40
from kamaki.cli.errors import raiseCLIError, CLISyntaxError, CLIBaseUrlError
41 41
from kamaki.cli.utils import (
42 42
    format_size, to_bytes, print_dict, print_items, pretty_keys, pretty_dict,
43
    page_hold, bold, ask_user, get_path_size, print_json)
43
    page_hold, bold, ask_user, get_path_size, print_json, guess_mime_type)
44 44
from kamaki.cli.argument import FlagArgument, ValueArgument, IntArgument
45 45
from kamaki.cli.argument import KeyValueArgument, DateArgument
46 46
from kamaki.cli.argument import ProgressBarArgument
......
983 983
    @errors.pithos.container
984 984
    @errors.pithos.object_path
985 985
    def _run(self):
986
        ctype, cenv = guess_mime_type(self.path)
986 987
        self._optional_output(self.client.create_object_by_manifestation(
987 988
            self.path,
988
            content_encoding=self['content_encoding'],
989
            content_encoding=self['content_encoding'] or cenc,
989 990
            content_disposition=self['content_disposition'],
990
            content_type=self['content_type'],
991
            content_type=self['content_type'], or ctype,
991 992
            sharing=self['sharing'],
992 993
            public=self['public']))
993 994

  
......
1135 1136
        container_info_cache = dict()
1136 1137
        for f, rpath in self._path_pairs(local_path, remote_path):
1137 1138
            print('%s --> %s:%s' % (f.name, self.client.container, rpath))
1139
            if not (self['content_type'] and self['content_encoding']):
1140
                ctype, cenc = guess_mime_type(f.name)
1141
                params['content_type'] = self['content_type'] or ctype
1142
                params['content_encoding'] = self['content_encoding'] or cenc
1138 1143
            if self['unchunked']:
1139 1144
                r = self.client.upload_object_unchunked(
1140 1145
                    rpath, f,

Also available in: Unified diff