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
3 changed files with 31 additions and 7 deletions

View File

@@ -50,6 +50,27 @@ jobs:
- name: Build documentation - name: Build documentation
run: sphinx-build -b html docs _build/html -W 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: test-postgres:
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
strategy: strategy:

View File

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

View File

@@ -1701,9 +1701,9 @@ class Superset(BaseSupersetView):
if not table: if not table:
return json_error_response( return json_error_response(
__( __(
"Table %(t)s wasn't found in the database %(d)s", "Table %(table)s wasn't found in the database %(db)s",
t=table_name, table=table_name,
s=db_name, db=db_name,
), ),
status=404, status=404,
) )
@@ -2308,9 +2308,11 @@ class Superset(BaseSupersetView):
except Exception as ex: except Exception as ex:
logger.exception(ex) logger.exception(ex)
msg = _( 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" "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 # 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)): if re.search(r"([\W]|^)4\d{2}([\W]|$)", str(ex)):