taucmdr.cli.cli_view module¶
A command line data view.
See http://en.wikipedia.org/wiki/Model-view-controller
- 
class taucmdr.cli.cli_view.AbstractCliView(model, module_name, summary_fmt=None, help_page_fmt=None, group=None, include_storage_flag=True)[source]¶
- Bases: - taucmdr.cli.command.AbstractCommand- A command that works as a view for a controller. - See http://en.wikipedia.org/wiki/Model-view-controller - 
controller¶
- The controller class for this view’s data. - Type: - class 
 
- 
- 
class taucmdr.cli.cli_view.CopyCommand(*args, **kwargs)[source]¶
- Bases: - taucmdr.cli.cli_view.CreateCommand- Base class for the copy subcommand of command line views. 
- 
class taucmdr.cli.cli_view.CreateCommand(*args, **kwargs)[source]¶
- Bases: - taucmdr.cli.cli_view.AbstractCliView- Base class for the create command of command line views. - 
_create_record(store, data)[source]¶
- Create the model record. - Parameters: - store (AbstractStorage) – Storage to contain the record.
- data (dict) – Record data.
 - Returns: - EXIT_SUCCESSif successful.- Return type: - Raises: - UniqueAttributeError– A record with the same unique attribute already exists.
 
- 
- 
class taucmdr.cli.cli_view.DeleteCommand(*args, **kwargs)[source]¶
- Bases: - taucmdr.cli.cli_view.AbstractCliView- Base class for the delete subcommand of command line views. 
- 
class taucmdr.cli.cli_view.EditCommand(*args, **kwargs)[source]¶
- Bases: - taucmdr.cli.cli_view.AbstractCliView- Base class for the edit subcommand of command line views. 
- 
class taucmdr.cli.cli_view.ListCommand(*args, **kwargs)[source]¶
- Bases: - taucmdr.cli.cli_view.AbstractCliView- Base class for the list subcommand of command line views. - 
_count_records(ctrl)[source]¶
- Print a record count to stdout. - Parameters: - controller (Controller) – Controller for the data model. 
 - 
_format_records(ctrl, style, keys=None, context=True)[source]¶
- Format records in a given style. - Retrieves records for controller ctrl and formats them. - Parameters: - ctrl (Controller) – Controller for the data model.
- style (str) – Style in which to format records.
- keys (list) – Keys to match to self.key_attr.
 - Returns: - Record data as formatted strings. - Return type: 
 - 
_list_records(storage_levels, keys, style, context=True)[source]¶
- Shows record data via print. - Parameters: - Returns: - EXIT_SUCCESSif successful.- Return type: 
 - 
_retrieve_records(ctrl, keys, context=True)[source]¶
- Retrieve modeled data from the controller. - Parameters: - ctrl (Controller) – Controller for the data model.
- keys (list) – Keys to match to self.key_attr.
 - Returns: - Model records. - Return type: 
 - 
dashboard_format(records)[source]¶
- Format modeled records in dashboard format. - Parameters: - records – Modeled records to format. - Returns: - Record data in dashboard format. - Return type: - str 
 - 
long_format(records)[source]¶
- Format records in long format. - Parameters: - records – Controlled records to format. - Returns: - Record data in long format. - Return type: - str 
 
- 
- 
class taucmdr.cli.cli_view.RootCommand(model, module_name, summary_fmt=None, help_page_fmt=None, group=None, include_storage_flag=True)[source]¶
- Bases: - taucmdr.cli.cli_view.AbstractCliView- A command with subcommands for actions. 
- 
class taucmdr.cli.cli_view.Texttable(max_width=80)[source]¶
- Bases: - texttable.Texttable- Extend the Texttable class to print header rows in bold. - 
_draw_line(line, isheader=False)[source]¶
- Override original Texttable’s _draw_line() method to make headers bold. - Draws a line by looping over a single cell length, over all the cells, making any header text bold. A better place to implement this would have been _splitit() but the logic in texttable does not strip ANSI escape sequences and treats them as printable characters. This may break when texttable is upgraded as it is marked for internal use only. Adapted from texttable v1.6.3: 
 
- 
