Skip to content

Commit

Permalink
Support underscore as a valid char in a key name
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesls committed Sep 16, 2015
1 parent 0274492 commit 7c099c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions awscli/shorthand.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ def _keyval(self):
return {key: values}

def _key(self):
# key = 1*(alpha / %x30-39) ; [a-zA-Z0-9\-]
valid_chars = string.ascii_letters + string.digits + '-'
# key = 1*(alpha / %x30-39 / %x5f) ; [a-zA-Z0-9\-_]
valid_chars = string.ascii_letters + string.digits + '-_'
start = self._index
while not self._at_eof():
if self._current() not in valid_chars:
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/test_shorthand.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ def test_parse():
# Dashes are allowed in key names.
yield (_can_parse, 'with-dash=bar', {'with-dash': 'bar'})

# Underscore are also allowed.
yield (_can_parse, 'with_underscore=bar', {'with_underscore': 'bar'})

# Explicit lists.
yield (_can_parse, 'foo=[]', {'foo': []})
yield (_can_parse, 'foo=[a]', {'foo': ['a']})
Expand Down

0 comments on commit 7c099c0

Please sign in to comment.