fix(babel): broken babel extract (#9790)

* fix(babel): broken babel extract

* remove unnecessary f strings
This commit is contained in:
Daniel Vaz Gaspar 2020-05-15 19:05:24 +01:00 committed by GitHub
parent 34df11a61c
commit ea9b7f2dc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 7 deletions

View File

@ -50,6 +50,27 @@ jobs:
- name: Build documentation
run: sphinx-build -b html docs _build/html -W
babel-extract:
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: [3.6]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
uses: apache-superset/cached-dependencies@adc6f73
with:
run: |
pip-install
pip install -r docs/requirements.txt
- name: Test babel extraction
run: flask fab babel-extract --target superset/translations --output superset/translations/messages.pot --config superset/translations/babel.cfg -k _,__,t,tn,tct
test-postgres:
runs-on: ubuntu-18.04
strategy:

View File

@ -127,10 +127,11 @@ class TableNotFoundValidationError(ValidationError):
def __init__(self, table_name: str) -> None:
super().__init__(
_(
f"Table [{table_name}] could not be found, "
"Table [%(table_name)s] could not be found, "
"please double check your "
"database connection, schema, and "
f"table name"
"table name",
table_name=table_name,
),
field_names=["table_name"],
)

View File

@ -1701,9 +1701,9 @@ class Superset(BaseSupersetView):
if not table:
return json_error_response(
__(
"Table %(t)s wasn't found in the database %(d)s",
t=table_name,
s=db_name,
"Table %(table)s wasn't found in the database %(db)s",
table=table_name,
db=db_name,
),
status=404,
)
@ -2308,9 +2308,11 @@ class Superset(BaseSupersetView):
except Exception as ex:
logger.exception(ex)
msg = _(
f"{validator.name} was unable to check your query.\n"
"%(validator)s was unable to check your query.\n"
"Please recheck your query.\n"
f"Exception: {ex}"
"Exception: %(ex)s",
validator=validator.name,
ex=ex,
)
# Return as a 400 if the database error message says we got a 4xx error
if re.search(r"([\W]|^)4\d{2}([\W]|$)", str(ex)):