Skip to content

Commit

Permalink
Fix extended arg handling for rest-export
Browse files Browse the repository at this point in the history
- Fixed Python 2 vs 3 unicode support differences in shlex.  (I forgot to run
  tox locally to double check Python 3 compatibility before the last commit.
  Whoops!)
  • Loading branch information
lowell80 committed Jan 29, 2019
1 parent 68d7e6f commit bc66315
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ksconf/commands/restexport.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,12 @@ def get_command(self):

def extend_args(self, args):
# Use shlex parsing to handle embedded quotes
# There are some known unicode limitations around shlex...
args = (s.decode("utf8") for s in shlex.split(args))
self.post_args.extend(args)
# Work around some of the known unicode limitations in shlex prior to Python 3.
# Technically, this does more than just parse quotes, but should be a good enough handler
for s in shlex.split(args):
if hasattr(s, "decode"):
s = s.decode("utf8")
self.post_args.append(s)


class RestExportCmd(KsconfCmd):
Expand Down

0 comments on commit bc66315

Please sign in to comment.