Skip to content

Commit

Permalink
Add argv utf-8 decoding for python 2.7.
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxbey committed Nov 18, 2016
1 parent 84d5029 commit 6ec52ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions serverauditor_sshconfig/core/storage/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions serverauditor_sshconfig/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down

0 comments on commit 6ec52ff

Please sign in to comment.