summaryrefslogtreecommitdiff
path: root/configuration.py
diff options
context:
space:
mode:
authorPierre-Yves David <pierre-yves.david@logilab.fr>2010-01-18 16:52:51 +0100
committerPierre-Yves David <pierre-yves.david@logilab.fr>2010-01-18 16:52:51 +0100
commitd23898fc964c40bb61cc699bd6cda0a3797b7c25 (patch)
tree32debd9123531b142afd8bc86e45ea225e5b88e3 /configuration.py
parentb96951d6a140b92d033a8d9eb53614e22e30c2c5 (diff)
downloadlogilab-common-d23898fc964c40bb61cc699bd6cda0a3797b7c25.tar.gz
[fix] Remove isinstance call for bytes units
The isinstance function was used to detect if a byte required unit application, This was leading to error when the value was a float. isinstance call is replaced by a more pythonix hasattribut __init__ check/
Diffstat (limited to 'configuration.py')
-rw-r--r--configuration.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/configuration.py b/configuration.py
index 6172c5c..6d03af1 100644
--- a/configuration.py
+++ b/configuration.py
@@ -311,8 +311,8 @@ def format_option_value(optdict, value):
value = "'%s'" % value
elif optdict.get('type') == 'time' and isinstance(value, (float, int, long)):
value = "%ss" % value
- elif optdict.get('type') == 'bytes' and isinstance(value, (int, long)):
- value = "%sB" % value
+ elif optdict.get('type') == 'bytes' and hasattr(value, '__int__'):
+ value = "%iB" % value
return value
def ini_format_section(stream, section, options, encoding=None, doc=None):