diff options
author | Radomir Dopieralski <openstack@sheep.art.pl> | 2014-02-11 13:04:32 +0100 |
---|---|---|
committer | Radomir Dopieralski <openstack@sheep.art.pl> | 2014-09-02 11:31:05 +0200 |
commit | 0f2bf801af4be94e29df26c351ef1c084ff8dd2f (patch) | |
tree | 459060109a3fca8afb8e2defab23b076b7026360 /horizon/tabs | |
parent | 6be6755dfa4b80b913dfc51b6b552adad1a1ca33 (diff) | |
download | horizon-0f2bf801af4be94e29df26c351ef1c084ff8dd2f.tar.gz |
Remove NotImplementedErrors from "virtual" methods
Raising a NotImplementedError in a method of a base class
makes it impossible to use super() with it and do multiple
inheritance properly. Those methods should instead simply
return some default "empty" value, so that the methods in
the subclasses can still call them, if that's where they
fall in the MRO.
Change-Id: I581391e87dc58f0f76adea3dbf90cef173d3daef
Closes-bug: 1278825
Diffstat (limited to 'horizon/tabs')
-rw-r--r-- | horizon/tabs/base.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/horizon/tabs/base.py b/horizon/tabs/base.py index 301f43080..8731de7eb 100644 --- a/horizon/tabs/base.py +++ b/horizon/tabs/base.py @@ -355,12 +355,11 @@ class Tab(html.HTMLElement): % self.__class__.__name__) return self.template_name - def get_context_data(self, request): + def get_context_data(self, request, **kwargs): """This method should return a dictionary of context data used to render the tab. Required. """ - raise NotImplementedError("%s needs to define a get_context_data " - "method." % self.__class__.__name__) + return kwargs def enabled(self, request): """Determines whether or not the tab should be accessible @@ -447,14 +446,14 @@ class TableTab(Tab): # Mark our data as loaded so we don't run the loaders again. self._table_data_loaded = True - def get_context_data(self, request): + def get_context_data(self, request, **kwargs): """Adds a ``{{ table_name }}_table`` item to the context for each table in the :attr:`~horizon.tabs.TableTab.table_classes` attribute. If only one table class is provided, a shortcut ``table`` context variable is also added containing the single table. """ - context = {} + context = super(TableTab, self).get_context_data(request, **kwargs) # If the data hasn't been manually loaded before now, # make certain it's loaded before setting the context. self.load_table_data() |