summaryrefslogtreecommitdiff
path: root/glanceclient/common/utils.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-05-28 16:57:34 +0000
committerGerrit Code Review <review@openstack.org>2014-05-28 16:57:34 +0000
commit803eed6083c9208cd0935131404ef7fb2d752964 (patch)
tree7aeea0cb183ebae08456b1131895e08e75eb2e4c /glanceclient/common/utils.py
parent8f89a14c9f0fbc9a189742270981938d69836204 (diff)
parent628c541a693ce39a524191250f93c967aef0dba5 (diff)
downloadpython-glanceclient-803eed6083c9208cd0935131404ef7fb2d752964.tar.gz
Merge "Finalize Python3 support"
Diffstat (limited to 'glanceclient/common/utils.py')
-rw-r--r--glanceclient/common/utils.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/glanceclient/common/utils.py b/glanceclient/common/utils.py
index 42c869a..8993cba 100644
--- a/glanceclient/common/utils.py
+++ b/glanceclient/common/utils.py
@@ -267,7 +267,8 @@ def get_file_size(file_obj):
:param file_obj: file-like object.
:retval The file's size or None if it cannot be determined.
"""
- if hasattr(file_obj, 'seek') and hasattr(file_obj, 'tell'):
+ if (hasattr(file_obj, 'seek') and hasattr(file_obj, 'tell') and
+ (six.PY2 or six.PY3 and file_obj.seekable())):
try:
curr = file_obj.tell()
file_obj.seek(0, os.SEEK_END)