mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-25 02:33:10 +00:00
remove remember contexts setting (#6496)
This commit is contained in:
@@ -138,27 +138,10 @@ class BaseController(metaclass=ABCMeta):
|
||||
|
||||
def load_class(self, class_ins, *args, **kwargs):
|
||||
"""Check for an existing instance of the controller before creating a new one."""
|
||||
settings = session.settings
|
||||
self.save_class()
|
||||
arguments = len(args) + len(kwargs)
|
||||
# Due to the 'arguments == 1' condition, we actually NEVER load a class
|
||||
# that has arguments (The 1 argument corresponds to self.queue)
|
||||
# Advantage: If the user changes something on one controller and then goes to the
|
||||
# controller below, it will create such class from scratch bringing all new variables
|
||||
# in and considering latest changes.
|
||||
# Disadvantage: If the user goes on a controller below and we have been there before
|
||||
# it will not load that previous class, but create a new one from scratch.
|
||||
# SCENARIO: If the user is in stocks and does load AAPL/ta the TA menu will get AAPL,
|
||||
# and if then the user goes back to the stocks menu using .. that menu will have AAPL
|
||||
# Now, if "arguments == 1" condition exists, if the user does "load TSLA" and then
|
||||
# goes into "TA", the "TSLA" ticker will appear. If that condition doesn't exist
|
||||
# the previous class will be loaded and even if the user changes the ticker on
|
||||
# the stocks context it will not impact the one of TA menu - unless changes are done.
|
||||
if (
|
||||
class_ins.PATH in controllers
|
||||
and arguments == 1
|
||||
and settings.REMEMBER_CONTEXTS
|
||||
):
|
||||
|
||||
if class_ins.PATH in controllers and arguments == 1:
|
||||
old_class = controllers[class_ins.PATH]
|
||||
old_class.queue = self.queue
|
||||
return old_class.menu()
|
||||
@@ -166,8 +149,7 @@ class BaseController(metaclass=ABCMeta):
|
||||
|
||||
def save_class(self) -> None:
|
||||
"""Save the current instance of the class to be loaded later."""
|
||||
if session.settings.REMEMBER_CONTEXTS:
|
||||
controllers[self.PATH] = self
|
||||
controllers[self.PATH] = self
|
||||
|
||||
def custom_reset(self) -> List[str]:
|
||||
"""Implement custom reset.
|
||||
|
||||
Reference in New Issue
Block a user