diff options
author | Doug Hellmann <doug.hellmann@dreamhost.com> | 2012-06-01 10:54:18 -0400 |
---|---|---|
committer | Doug Hellmann <doug.hellmann@dreamhost.com> | 2012-06-01 10:54:18 -0400 |
commit | 748ef2b230588c66e240ceb93471b0ceaeca1f8e (patch) | |
tree | 17ad5c9ba4e374cd3668a7201d47c1724b2cb204 /demoapp | |
parent | 9059e9538a449f0fc36ad4b43cadc6bd8a2f1e0e (diff) | |
download | cliff-tablib-748ef2b230588c66e240ceb93471b0ceaeca1f8e.tar.gz |
Refactor DisplayBase.run() to make it easier to override separate parts in subclasses.
Rename get_data() to take_action() so subclasses that do something other than query for values have a clear place to override.
Diffstat (limited to 'demoapp')
-rw-r--r-- | demoapp/cliffdemo/list.py | 2 | ||||
-rw-r--r-- | demoapp/cliffdemo/show.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/demoapp/cliffdemo/list.py b/demoapp/cliffdemo/list.py index 124997f..3dcee4a 100644 --- a/demoapp/cliffdemo/list.py +++ b/demoapp/cliffdemo/list.py @@ -12,7 +12,7 @@ class Files(Lister): log = logging.getLogger(__name__) - def get_data(self, parsed_args): + def take_action(self, parsed_args): return (('Name', 'Size'), ((n, os.stat(n).st_size) for n in os.listdir('.')) ) diff --git a/demoapp/cliffdemo/show.py b/demoapp/cliffdemo/show.py index 54d98be..9351148 100644 --- a/demoapp/cliffdemo/show.py +++ b/demoapp/cliffdemo/show.py @@ -14,7 +14,7 @@ class File(ShowOne): parser.add_argument('filename', nargs='?', default='.') return parser - def get_data(self, parsed_args): + def take_action(self, parsed_args): stat_data = os.stat(parsed_args.filename) columns = ('Name', 'Size', |