def ensure_login(*args, **kwargs): session = args[0] # I make sure that the connection is present.. if not common.is_internet_connected(): raise NotConnected('Internet connection not available') # ..this check verifies only if locally there are the data to correctly perform the login if not session.is_logged_in(): raise NotLoggedInError return func(*args, **kwargs)
def assert_logged_in(self): """Raise an exception when login cannot be established or maintained""" if not common.is_internet_connected(): raise NotConnected('Internet connection not available') if not self.is_logged_in(): raise NotLoggedInError