summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-08-25 22:47:41 +0000
committerGerrit Code Review <review@openstack.org>2016-08-25 22:47:41 +0000
commit19cd127294cca46979671c51e68ba6601028628d (patch)
treef4fdb51a2a3bfcb9ec37ef0cf936ff4b3a250914
parent9cdeedab7dea2d0b224c7347d9fe9a2268ae167a (diff)
parent96f0031e642081fabfcda19f2fbc66b86e97339e (diff)
downloadpython-swiftclient-19cd127294cca46979671c51e68ba6601028628d.tar.gz
Merge "boolean logic cleanup in service.Swift[Copy|Post]Object"
-rw-r--r--swiftclient/service.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/swiftclient/service.py b/swiftclient/service.py
index 0c16262..f204895 100644
--- a/swiftclient/service.py
+++ b/swiftclient/service.py
@@ -323,13 +323,12 @@ class SwiftPostObject(object):
specified separately for each individual object.
"""
def __init__(self, object_name, options=None):
- if not isinstance(object_name, string_types) or not object_name:
+ if not (isinstance(object_name, string_types) and object_name):
raise SwiftError(
"Object names must be specified as non-empty strings"
)
- else:
- self.object_name = object_name
- self.options = options
+ self.object_name = object_name
+ self.options = options
class SwiftCopyObject(object):
@@ -340,7 +339,7 @@ class SwiftCopyObject(object):
destination and fresh_metadata should be set in options
"""
def __init__(self, object_name, options=None):
- if not isinstance(object_name, string_types) or not object_name:
+ if not (isinstance(object_name, string_types) and object_name):
raise SwiftError(
"Object names must be specified as non-empty strings"
)