From a3322126d31e36a409f2c8cde915f9f39b81ba5e Mon Sep 17 00:00:00 2001 From: Kiran Jonnalagadda Date: Thu, 7 Jul 2022 13:51:43 +0530 Subject: [PATCH] Switch to Flask-Babel (#1413) --- funnel/__init__.py | 2 +- funnel/forms/account.py | 2 +- funnel/forms/venue.py | 2 +- funnel/models/session.py | 2 +- funnel/views/account_reset.py | 2 +- funnel/views/notification.py | 2 +- funnel/views/notifications/rsvp_notification.py | 2 +- pyproject.toml | 2 +- requirements.in | 2 +- requirements.txt | 13 +++++-------- requirements_dev.txt | 4 ++-- tests/unit/models/test_helpers.py | 2 +- 12 files changed, 17 insertions(+), 20 deletions(-) diff --git a/funnel/__init__.py b/funnel/__init__.py index affc6405a..87d65ccff 100644 --- a/funnel/__init__.py +++ b/funnel/__init__.py @@ -9,7 +9,7 @@ import os.path from flask import Flask -from flask_babelhg import get_locale +from flask_babel import get_locale from flask_flatpages import FlatPages from flask_mailman import Mail from flask_migrate import Migrate diff --git a/funnel/forms/account.py b/funnel/forms/account.py index abf2b05ea..46c8a57b0 100644 --- a/funnel/forms/account.py +++ b/funnel/forms/account.py @@ -5,7 +5,7 @@ from hashlib import sha1 from typing import Dict, Iterable, Optional -from flask_babelhg import ngettext +from flask_babel import ngettext import requests diff --git a/funnel/forms/venue.py b/funnel/forms/venue.py index 43803fa56..37f7d94bf 100644 --- a/funnel/forms/venue.py +++ b/funnel/forms/venue.py @@ -5,7 +5,7 @@ import gettext import re -from flask_babelhg import get_locale +from flask_babel import get_locale import pycountry diff --git a/funnel/models/session.py b/funnel/models/session.py index 9bcc0c8c0..6b8ea259f 100644 --- a/funnel/models/session.py +++ b/funnel/models/session.py @@ -6,7 +6,7 @@ from datetime import datetime, timedelta from typing import Any, Dict, Optional, Type -from flask_babelhg import get_locale +from flask_babel import get_locale from werkzeug.utils import cached_property from babel.dates import format_date diff --git a/funnel/views/account_reset.py b/funnel/views/account_reset.py index f42462fcd..caa0cb11a 100644 --- a/funnel/views/account_reset.py +++ b/funnel/views/account_reset.py @@ -15,7 +15,7 @@ session, url_for, ) -from flask_babelhg import ngettext +from flask_babel import ngettext import itsdangerous from baseframe import _ diff --git a/funnel/views/notification.py b/funnel/views/notification.py index 9a8d44d9f..b31e57353 100644 --- a/funnel/views/notification.py +++ b/funnel/views/notification.py @@ -11,7 +11,7 @@ from uuid import uuid4 from flask import url_for -from flask_babelhg import force_locale +from flask_babel import force_locale from werkzeug.utils import cached_property from typing_extensions import Literal diff --git a/funnel/views/notifications/rsvp_notification.py b/funnel/views/notifications/rsvp_notification.py index 4e4154dea..e2e851638 100644 --- a/funnel/views/notifications/rsvp_notification.py +++ b/funnel/views/notifications/rsvp_notification.py @@ -5,7 +5,7 @@ from typing import List, Optional from flask import render_template -from flask_babelhg import get_locale +from flask_babel import get_locale from baseframe import _, __ from baseframe.filters import datetime_filter diff --git a/pyproject.toml b/pyproject.toml index 2057539b9..601bba5a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,7 +88,7 @@ known_flask = [ 'wtforms', 'webassets', 'flask_assets', - 'flask_babelhg', + 'flask_babel', 'flask_executor', 'flask_flatpages', 'flask_mailman', diff --git a/requirements.in b/requirements.in index 57cd61de4..f4c7929ef 100644 --- a/requirements.in +++ b/requirements.in @@ -12,6 +12,7 @@ dataclasses-json fabric3 Flask Flask-Assets +Flask-Babel Flask-Executor Flask-FlatPages flask-mailman @@ -24,7 +25,6 @@ furl geoip2 git+https://github.com/hasgeek/baseframe.git#egg=baseframe git+https://github.com/hasgeek/coaster.git#egg=coaster -git+https://github.com/hasgeek/flask-babelhg.git#egg=Flask-Babelhg html2text icalendar idna>=2.5 diff --git a/requirements.txt b/requirements.txt index 15d434bc7..66ee36508 100644 --- a/requirements.txt +++ b/requirements.txt @@ -27,7 +27,7 @@ attrs==21.4.0 babel==2.10.3 # via # -r requirements.in - # flask-babelhg + # flask-babel base58==2.1.1 # via # -r requirements.in @@ -114,7 +114,7 @@ flask==2.1.2 # baseframe # coaster # flask-assets - # flask-babelhg + # flask-babel # flask-caching # flask-executor # flask-flatpages @@ -130,7 +130,7 @@ flask-assets==2.0 # -r requirements.in # baseframe # coaster -flask-babelhg @ git+https://github.com/hasgeek/flask-babelhg.git +flask-babel==2.0.0 # via # -r requirements.in # baseframe @@ -211,7 +211,7 @@ jinja2==3.1.2 # via # coaster # flask - # flask-babelhg + # flask-babel # flask-flatpages joblib==1.1.0 # via nltk @@ -347,6 +347,7 @@ pytz==2022.1 # babel # baseframe # coaster + # flask-babel # icalendar # twilio pytz-deprecation-shim==0.1.0.post0 @@ -403,8 +404,6 @@ semantic-version==2.10.0 # coaster sentry-sdk==1.6.0 # via baseframe -simplejson==3.17.6 - # via coaster six==1.16.0 # via # bleach @@ -424,8 +423,6 @@ six==1.16.0 # sqlalchemy-utils # tuspy # url-normalize -speaklater==1.3 - # via baseframe sqlalchemy==1.4.39 # via # -r requirements.in diff --git a/requirements_dev.txt b/requirements_dev.txt index 545f4ca84..16938493f 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -32,7 +32,7 @@ dill==0.3.5.1 # via pylint distlib==0.3.4 # via virtualenv -djlint==1.4.0 +djlint==1.6.0 # via -r requirements_dev.in filelock==3.7.1 # via virtualenv @@ -216,7 +216,7 @@ tomli==2.0.1 # pep517 # pylint # pytest -tomlkit==0.11.0 +tomlkit==0.11.1 # via pylint tqdm==4.64.0 # via djlint diff --git a/tests/unit/models/test_helpers.py b/tests/unit/models/test_helpers.py index 0f7776ccb..ea794483a 100644 --- a/tests/unit/models/test_helpers.py +++ b/tests/unit/models/test_helpers.py @@ -5,7 +5,7 @@ from sqlalchemy.exc import StatementError -from flask_babelhg import lazy_gettext +from flask_babel import lazy_gettext import pytest