diff options
author | Mitch Garnaat <mitch@cloudright.com> | 2010-08-20 16:15:31 -0400 |
---|---|---|
committer | Mitch Garnaat <mitch@cloudright.com> | 2010-08-20 16:15:31 -0400 |
commit | 892cf061e5d8ec9c1beea05159fd3272788d5cdc (patch) | |
tree | e67a0bcd5eb815a28ca8d792f9c1a2c59e4fd55b | |
parent | 7bb3a030da0b45d5197d6a9c2a3025aa8deb10b5 (diff) | |
download | boto-892cf061e5d8ec9c1beea05159fd3272788d5cdc.tar.gz |
Fixed a bug in change_storage_class method found by user KT.
-rw-r--r-- | boto/s3/key.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/boto/s3/key.py b/boto/s3/key.py index ae742fbf..38939e18 100644 --- a/boto/s3/key.py +++ b/boto/s3/key.py @@ -218,9 +218,15 @@ class Key(object): will be used. """ - self.storage_class = new_storage_class - return self.copy(self.bucket.name, self.name, - reduced_redundancy=True, preserve_acl=True) + if new_storage_class == 'STANDARD': + return self.copy(self.bucket.name, self.name, + reduced_redundancy=False, preserve_acl=True) + elif new_storage_class == 'REDUCED_REDUNDANCY': + return self.copy(self.bucket.name, self.name, + reduced_redundancy=True, preserve_acl=True) + else: + raise BotoClientError('Invalid storage class: %s' % + new_storage_class) def copy(self, dst_bucket, dst_key, metadata=None, reduced_redundancy=False, preserve_acl=False): |