Alon Bar-Lev has uploaded a new change for review.

Change subject: core: fix python-2.6 compatibility in decode()
......................................................................

core: fix python-2.6 compatibility in decode()

Change-Id: Ia8074b2051e259d892f8ae771389e065bf072f7a
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M ChangeLog
M src/otopi/plugin.py
2 files changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/otopi refs/changes/93/13293/1

diff --git a/ChangeLog b/ChangeLog
index df86b1d..3abee8d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 
 ????-??-?? - Version 1.1.0
 
+ * core: supprot non unicode command output.
  * packagers: yum: do not enable if running non root.
  * packagers: yum: selinux: do not change type to rpm_t.
  * java: do not fail to set null environment.
diff --git a/src/otopi/plugin.py b/src/otopi/plugin.py
index f2f7da8..4eee8e4 100644
--- a/src/otopi/plugin.py
+++ b/src/otopi/plugin.py
@@ -397,14 +397,15 @@
         (rc, stdout, stderr) = self.executeRaw(
             args=args,
             stdin=(
-                '\n'.join(stdin).encode(encoding='utf-8')
+                '\n'.join(stdin).encode('utf-8')
                 if stdin is not None else None
             ),
             *eargs,
             **kwargs
         )
-        stdout = stdout.decode(encoding='utf-8', errors='replace').splitlines()
-        stderr = stderr.decode(encoding='utf-8', errors='replace').splitlines()
+        # warning: python-2.6 does not have kwargs for decode
+        stdout = stdout.decode('utf-8', 'replace').splitlines()
+        stderr = stderr.decode('utf-8', 'replace').splitlines()
         self.logger.debug(
             'execute-output: %s stdout:\n%s\n',
             args,


--
To view, visit http://gerrit.ovirt.org/13293
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia8074b2051e259d892f8ae771389e065bf072f7a
Gerrit-PatchSet: 1
Gerrit-Project: otopi
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to