Skip to content

Commit

Permalink
Handle WEBDRIVER_BASEURL slashes
Browse files Browse the repository at this point in the history
As suggested, we handle both cases (trailing slash, no trailing slash) for the WEBDRIVER_BASEURL. We use the existing `superset.utils.urls` `get_url_path(...)` function to manage everything.
  • Loading branch information
Usiel committed May 10, 2023
1 parent ca9fb2a commit 6ba3f60
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions superset/tasks/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@
from superset.tags.models import Tag, TaggedObject
from superset.utils.date_parser import parse_human_datetime
from superset.utils.machine_auth import MachineAuthProvider
from superset.utils.urls import get_url_path

logger = get_task_logger(__name__)
logger.setLevel(logging.INFO)


def get_url(chart: Slice, dashboard: Optional[Dashboard] = None) -> str:
"""Return external URL for warming up a given chart/table cache."""
with app.test_request_context():
baseurl = "{WEBDRIVER_BASEURL}".format(**app.config)
url = f"{baseurl}superset/warm_up_cache/?slice_id={chart.id}"
if dashboard:
url += f"&dashboard_id={dashboard.id}"
return url
return get_url_path(
"Superset.warm_up_cache",
slice_id=chart.id,
dashboard_id=dashboard.id if dashboard else None,
)


class Strategy: # pylint: disable=too-few-public-methods
Expand Down

0 comments on commit 6ba3f60

Please sign in to comment.