Skip to content

Commit

Permalink
chg: [dependencies] Major update to the dependencies and updated code…
Browse files Browse the repository at this point in the history
… accordingly.
  • Loading branch information
cedricbonhomme committed Dec 13, 2023
1 parent c67a8ac commit cb49715
Show file tree
Hide file tree
Showing 3 changed files with 321 additions and 291 deletions.
16 changes: 9 additions & 7 deletions mosp/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from typing import Union

from flask import Flask
from flask import g
from flask import request
from flask_babel import Babel
from flask_babel import format_datetime
Expand Down Expand Up @@ -76,7 +77,6 @@ def set_logging(
db = SQLAlchemy(application)
migrate = Migrate(application, db)

babel = Babel(application)

cors = CORS(
application,
Expand All @@ -87,7 +87,7 @@ def set_logging(
)


@babel.localeselector
# i18n and l10n support
def get_locale():
# if a user is logged in, use the locale from the user settings
# user = getattr(g, 'user', None)
Expand All @@ -101,11 +101,13 @@ def get_locale():
)


# @babel.timezoneselector
# def get_timezone():
# user = getattr(g, 'user', None)
# if user is not None:
# return user.timezone
def get_timezone():
user = getattr(g, "user", None)
if user is not None:
return user.timezone


babel = Babel(application, locale_selector=get_locale, timezone_selector=get_timezone)


# Jinja filters
Expand Down
Loading

0 comments on commit cb49715

Please sign in to comment.