def must_send_stats(cls): try: stat_settings = getattr( cls.get_one(), "settings", {} ).get("statistics", {}) return stat_settings.get("user_choice_saved", {}).\ get("value", False) and \ stat_settings.get("send_anonymous_statistic", {}). \ get("value", False) except (AttributeError, TypeError) as e: logger.exception( "Get statistics settings failed: %s", six.text_type(e)) return False
def must_send_stats(cls, master_node_settings_data=None): """Checks if stats must be sent Stats must be sent if user saved the choice and sending anonymous statistics was selected. :param master_node_settings_data: dict with master node settings. If master_node_settings_data is None data from DB will be fetched :return: bool """ try: if master_node_settings_data is None: settings = getattr(cls.get_one(), "settings", {}) else: settings = master_node_settings_data.get("settings") stat_settings = settings.get("statistics", {}) return stat_settings.get("user_choice_saved", {}).get("value", False) and stat_settings.get( "send_anonymous_statistic", {} ).get("value", False) except (AttributeError, TypeError) as e: logger.exception("Get statistics settings failed: %s", six.text_type(e)) return False
def must_send_stats(cls, master_node_settings_data=None): """Checks if stats must be sent Stats must be sent if user saved the choice and sending anonymous statistics was selected. :param master_node_settings_data: dict with master node settings. If master_node_settings_data is None data from DB will be fetched :return: bool """ try: if master_node_settings_data is None: settings = getattr(cls.get_one(), "settings", {}) else: settings = master_node_settings_data.get("settings") stat_settings = settings.get("statistics", {}) return stat_settings.get("user_choice_saved", {}).\ get("value", False) and \ stat_settings.get("send_anonymous_statistic", {}). \ get("value", False) except (AttributeError, TypeError) as e: logger.exception("Get statistics settings failed: %s", six.text_type(e)) return False