diff options
author | Frederic Lepied <frederic.lepied@enovance.com> | 2014-04-26 23:34:58 +0200 |
---|---|---|
committer | Frederic Lepied <frederic.lepied@enovance.com> | 2014-05-20 16:42:10 +0200 |
commit | 628c541a693ce39a524191250f93c967aef0dba5 (patch) | |
tree | b14db79d7e8062e4ca1c62e0a11abd3bc985fe27 /glanceclient/common/utils.py | |
parent | f2e0610628bf646003c40668adfa5a6c4318cbc3 (diff) | |
download | python-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.py | 3 |
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) |