diff --git a/superset/dashboards/filter_state/commands/get.py b/superset/dashboards/filter_state/commands/get.py index d95f6b0b94ec..3087389cc5a2 100644 --- a/superset/dashboards/filter_state/commands/get.py +++ b/superset/dashboards/filter_state/commands/get.py @@ -24,13 +24,13 @@ class GetFilterStateCommand(GetKeyValueCommand): - def get(self, resource_id: int, key: str, refreshTimeout: bool) -> Optional[str]: + def get(self, resource_id: int, key: str, refresh_timeout: bool) -> Optional[str]: dashboard = DashboardDAO.get_by_id_or_slug(str(resource_id)) if dashboard: entry: Entry = cache_manager.filter_state_cache.get( cache_key(resource_id, key) ) - if refreshTimeout: + if refresh_timeout: cache_manager.filter_state_cache.set(key, entry) return entry["value"] return None diff --git a/superset/key_value/__init__.py b/superset/key_value/__init__.py new file mode 100644 index 000000000000..13a83393a912 --- /dev/null +++ b/superset/key_value/__init__.py @@ -0,0 +1,16 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. diff --git a/superset/key_value/commands/get.py b/superset/key_value/commands/get.py index be56050fa063..43a5806cb595 100644 --- a/superset/key_value/commands/get.py +++ b/superset/key_value/commands/get.py @@ -38,8 +38,8 @@ def __init__(self, actor: User, resource_id: int, key: str): def run(self) -> Model: try: config = app.config["FILTER_STATE_CACHE_CONFIG"] - refreshTimeout = config.get("REFRESH_TIMEOUT_ON_RETRIEVAL") - return self.get(self._resource_id, self._key, refreshTimeout) + refresh_timeout = config.get("REFRESH_TIMEOUT_ON_RETRIEVAL") + return self.get(self._resource_id, self._key, refresh_timeout) except SQLAlchemyError as ex: logger.exception("Error running get command") raise KeyValueGetFailedError() from ex @@ -48,5 +48,5 @@ def validate(self) -> None: pass @abstractmethod - def get(self, resource_id: int, key: str, refreshTimeout: bool) -> Optional[str]: + def get(self, resource_id: int, key: str, refresh_timeout: bool) -> Optional[str]: ...