summaryrefslogtreecommitdiff
path: root/reconfigure/configs/base.py
diff options
context:
space:
mode:
authorAndrew Shadura <andrew@shadura.me>2015-08-20 16:04:48 +0200
committerAndrew Shadura <andrew@shadura.me>2015-08-20 16:04:48 +0200
commit2989b4c027b3230b1778e3777d2cce53c89808d9 (patch)
treeeaae33622a6ced0a09a5610d79ab9d54e77a5a9f /reconfigure/configs/base.py
parent1e93e1498efdfd85a599a7e831f4a3a55f78aa75 (diff)
Imported Upstream version 0.1.74+git49a20890
Diffstat (limited to 'reconfigure/configs/base.py')
-rw-r--r--reconfigure/configs/base.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/reconfigure/configs/base.py b/reconfigure/configs/base.py
index 5d0bb61..fc2ce6f 100644
--- a/reconfigure/configs/base.py
+++ b/reconfigure/configs/base.py
@@ -1,4 +1,6 @@
import chardet
+import six
+import sys
class Reconfig (object):
@@ -36,7 +38,8 @@ class Reconfig (object):
self.content = open(self.origin, 'r').read()
self.encoding = 'utf8'
- if hasattr(self.content, 'decode'): # str (2) or bytes (3)
+ if (six.PY3 and isinstance(self.content, bytes)) or \
+ (six.PY2 and isinstance(self.content, str)):
try:
self.content = self.content.decode('utf8')
except (UnicodeDecodeError, AttributeError):