summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxschlef <joka@uni-paderborn.de>2019-07-18 09:17:02 +0200
committerxschlef <joka@uni-paderborn.de>2019-07-18 09:17:02 +0200
commitcc24e9e2635974a3c7521b660d4f72fd8db26661 (patch)
treeb9756b1180efd8b0fefdaa3504b02567fdc8d4cd
parentad2b80f4d2b940f7b4a15c94e6324b35fe0a762e (diff)
downloadbcfg2-cc24e9e2635974a3c7521b660d4f72fd8db26661.tar.gz
bcfg2-cc24e9e2635974a3c7521b660d4f72fd8db26661.tar.bz2
bcfg2-cc24e9e2635974a3c7521b660d4f72fd8db26661.zip
Do not encode py3 strings to utf-8 again. Compat.unicode matches strings and unicode in py3.
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Probes.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Probes.py b/src/lib/Bcfg2/Server/Plugins/Probes.py
index 0a0ed9414..270bfa62d 100644
--- a/src/lib/Bcfg2/Server/Plugins/Probes.py
+++ b/src/lib/Bcfg2/Server/Plugins/Probes.py
@@ -307,7 +307,8 @@ class ProbeData(str): # pylint: disable=E0012,R0924
.json, and .yaml properties to provide convenient ways to use
ProbeData objects as XML, JSON, or YAML data """
def __new__(cls, data):
- if isinstance(data, unicode):
+ # prevent double encoding utf-8 in python3
+ if isinstance(data, unicode) and not isinstance(data, str):
return str.__new__(cls, data.encode('utf-8'))
else:
return str.__new__(cls, data)