summaryrefslogtreecommitdiff
path: root/glanceclient/common/utils.py
diff options
context:
space:
mode:
authorFrederic Lepied <frederic.lepied@enovance.com>2014-04-26 23:34:58 +0200
committerFrederic Lepied <frederic.lepied@enovance.com>2014-05-20 16:42:10 +0200
commit628c541a693ce39a524191250f93c967aef0dba5 (patch)
treeb14db79d7e8062e4ca1c62e0a11abd3bc985fe27 /glanceclient/common/utils.py
parentf2e0610628bf646003c40668adfa5a6c4318cbc3 (diff)
downloadpython-glanceclient-628c541a693ce39a524191250f93c967aef0dba5.tar.gz
Finalize Python3 support
Set the environment variable PYTHONHASHSEED to 0 to have predictive tests under Python 3. Change-Id: Ia15a9383e0f20bd0e4572e9f9b9772f1704dff86
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 04350d5..620d87a 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)