Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Locale object/string mixup #27881

Closed
3 tasks done
smalyshev opened this issue Apr 3, 2024 · 0 comments · Fixed by #27926
Closed
3 tasks done

Locale object/string mixup #27881

smalyshev opened this issue Apr 3, 2024 · 0 comments · Fixed by #27926
Assignees

Comments

@smalyshev
Copy link

smalyshev commented Apr 3, 2024

Bug description

In common_bootstrap_payload the code uses this:

        **cached_common_bootstrap_data(utils.get_user_id(), get_locale()),

cached_common_bootstrap_data is defined as:

def cached_common_bootstrap_data(  # pylint: disable=unused-argument
    user_id: int | None, locale: str
) -> dict[str, Any]:

However, get_locale is defined in flask_babel as:

def get_locale():
    """Returns the locale that should be used for this request as
    `babel.Locale` object.  This returns `None` if used outside of
    a request.
    """

So, the function expects string, but is sent an object instead. This probably should be fixed to either have get_locale result be converted to string explicitly, or make cached_common_bootstrap_data accept correct object.

How to reproduce the bug

See the code above

Screenshots/recordings

No response

Superset version

3.0.4

Python version

3.10

Node version

16

Browser

Not applicable

Additional context

No response

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants