summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Hellmann <doug.hellmann@dreamhost.com>2014-01-28 20:33:04 -0500
committerDoug Hellmann <doug.hellmann@dreamhost.com>2014-01-28 20:33:04 -0500
commit5cf407a38bf3912dd405e522d6d16550f70987e9 (patch)
tree55d1d47b5ae66fad3b13133a2d595e8a9850c9cb
parent5fad56e89f4daeaeccfdcdb0210f23d94086e9e1 (diff)
downloadcliff-5cf407a38bf3912dd405e522d6d16550f70987e9.tar.gz
Rename private attribute to avoid conflict
The neutronclient code is using '_formatters' for some column formatters. Rather than change their code in multiple branches, just rename our use of _formatters here to a unique name. Change-Id: I85272bcf4c3daa5fbb52ab75945e567a786bd203
-rw-r--r--cliff/display.py8
-rw-r--r--cliff/tests/test_lister.py2
2 files changed, 5 insertions, 5 deletions
diff --git a/cliff/display.py b/cliff/display.py
index 989b886..e04fd29 100644
--- a/cliff/display.py
+++ b/cliff/display.py
@@ -18,7 +18,7 @@ class DisplayCommandBase(Command):
def __init__(self, app, app_args):
super(DisplayCommandBase, self).__init__(app, app_args)
- self._formatters = self._load_formatter_plugins()
+ self._formatter_plugins = self._load_formatter_plugins()
@abc.abstractproperty
def formatter_namespace(self):
@@ -41,7 +41,7 @@ class DisplayCommandBase(Command):
title='output formatters',
description='output formatter options',
)
- formatter_choices = sorted(self._formatters.names())
+ formatter_choices = sorted(self._formatter_plugins.names())
formatter_default = self.formatter_default
if formatter_default not in formatter_choices:
formatter_default = formatter_choices[0]
@@ -61,7 +61,7 @@ class DisplayCommandBase(Command):
metavar='COLUMN',
help='specify the column(s) to include, can be repeated',
)
- for formatter in self._formatters:
+ for formatter in self._formatter_plugins:
formatter.obj.add_argument_group(parser)
return parser
@@ -76,7 +76,7 @@ class DisplayCommandBase(Command):
"""
def run(self, parsed_args):
- self.formatter = self._formatters[parsed_args.formatter].obj
+ self.formatter = self._formatter_plugins[parsed_args.formatter].obj
column_names, data = self.take_action(parsed_args)
self.produce_output(parsed_args, column_names, data)
return 0
diff --git a/cliff/tests/test_lister.py b/cliff/tests/test_lister.py
index d3b27b5..2855051 100644
--- a/cliff/tests/test_lister.py
+++ b/cliff/tests/test_lister.py
@@ -41,7 +41,7 @@ def test_formatter_args():
parsed_args.formatter = 'test'
test_lister.run(parsed_args)
- f = test_lister._formatters['test']
+ f = test_lister._formatter_plugins['test']
assert len(f.args) == 1
args = f.args[0]
assert args[0] == list(parsed_args.columns)