From 6ec52ff606db12bdbd21f7c308bf31901d940307 Mon Sep 17 00:00:00 2001 From: Maxbey Date: Wed, 16 Nov 2016 18:48:59 +0600 Subject: [PATCH] Add argv utf-8 decoding for python 2.7. --- serverauditor_sshconfig/core/storage/query.py | 1 + serverauditor_sshconfig/main.py | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/serverauditor_sshconfig/core/storage/query.py b/serverauditor_sshconfig/core/storage/query.py index 4741962..4001b38 100644 --- a/serverauditor_sshconfig/core/storage/query.py +++ b/serverauditor_sshconfig/core/storage/query.py @@ -13,6 +13,7 @@ def __init__(self, field, value): """Construct new operator.""" splited_field = field.split('.') operator_name = splited_field[-1] + if operator_name not in self.operators: operator_name = 'eq' self.get_field = operators.attrgetter(field) diff --git a/serverauditor_sshconfig/main.py b/serverauditor_sshconfig/main.py index e858ede..63f67ad 100644 --- a/serverauditor_sshconfig/main.py +++ b/serverauditor_sshconfig/main.py @@ -8,6 +8,15 @@ def main(argv=sys.argv[1:]): """Process call from terminal.""" app = ServerauditorApp() + + if sys.version_info < (3,): + decoded_argv = [] + + for arg in argv: + decoded_argv.append(arg.decode('utf8')) + + return app.run(decoded_argv) + return app.run(argv)