Skip to content

Commit

Permalink
Merge bfbfcc6 into 05af64f
Browse files Browse the repository at this point in the history
  • Loading branch information
bliuredhat committed Dec 1, 2015
2 parents 05af64f + bfbfcc6 commit 13d62fe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions pdc_client/plugin_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,9 @@ def extract_arguments(args, prefix=DATA_PREFIX):
# At this point `d` points to the correct dict and value can be
# inserted.
d[parts[-1]] = value if value != '' else None
try:
if args.page_size:
data['page_size'] = args.page_size
except AttributeError:
pass
return data
3 changes: 2 additions & 1 deletion pdc_client/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ def setup(self):
self.parser.add_argument('--debug', action='store_true', help=argparse.SUPPRESS)
self.parser.add_argument('--json', action='store_true',
help='display output as JSON')

self.parser.add_argument('--page-size', dest='page_size',
help='change page size in response')
subparsers = self.parser.add_subparsers(metavar='COMMAND')

for plugin in self.plugins:
Expand Down
3 changes: 2 additions & 1 deletion tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ class Temp(object):
args = Temp()
setattr(args, 'prf__foo__bar__baz', 1)
setattr(args, 'prf__foo__bar__quux', 2)
setattr(args, 'page_size', 5)
data = plugin_helpers.extract_arguments(args, prefix='prf__')
self.assertEqual(data,
{'foo': {'bar': {'baz': 1, 'quux': 2}}})
{'foo': {'bar': {'baz': 1, 'quux': 2}}, 'page_size': 5})


class PrettyPrinterTestCase(unittest.TestCase):
Expand Down

0 comments on commit 13d62fe

Please sign in to comment.