commit:     26352316808100b05b5504b69ed8d1b22053ddb2
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 25 20:38:17 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Dec 25 20:38:17 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=26352316

gkeys/base.py: Py3 compatibility fix

---
 gkeys/gkeys/base.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gkeys/gkeys/base.py b/gkeys/gkeys/base.py
index e7dd710..5ad92e7 100644
--- a/gkeys/gkeys/base.py
+++ b/gkeys/gkeys/base.py
@@ -15,11 +15,16 @@ from __future__ import print_function
 
 
 import argparse
+import sys
 
 from gkeys import config, fileops, seed, lib
 from gkeys.log import log_levels, set_logger
 
 
+if sys.version_info[0] >= 3:
+    unicode = str
+
+
 class CliBase(object):
     '''Common cli and argsparse options class'''
 
@@ -246,7 +251,7 @@ class CliBase(object):
         if header:
             print(header)
         for msg in results:
-            if isinstance(msg, str) or isinstance(msg, unicode):
+            if type(msg) in [str, unicode]:
                 print('    ', msg)
             else:
                 try:

Reply via email to