diff options
author | Bryan Newbold <bnewbold@archive.org> | 2021-05-21 12:22:39 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2021-06-11 15:41:20 -0700 |
commit | d1c79a4abdfbbec8d84501c8bed8b5084e1285f6 (patch) | |
tree | ce4824e023469bdd545305c83a4d4205f1d0b270 | |
parent | c743b6a1508f22fba3cc66c1ae280448beb6891d (diff) | |
download | fatcat-scholar-d1c79a4abdfbbec8d84501c8bed8b5084e1285f6.tar.gz fatcat-scholar-d1c79a4abdfbbec8d84501c8bed8b5084e1285f6.zip |
fix jinja2/babel deprecations
-rw-r--r-- | fatcat_scholar/hacks.py | 2 | ||||
-rw-r--r-- | fatcat_scholar/templates/search.html | 4 | ||||
-rw-r--r-- | fatcat_scholar/templates/search_macros.html | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/fatcat_scholar/hacks.py b/fatcat_scholar/hacks.py index e7d4566..29274c9 100644 --- a/fatcat_scholar/hacks.py +++ b/fatcat_scholar/hacks.py @@ -18,7 +18,7 @@ class Jinja2Templates: def get_env( self, directory: str, extensions: typing.List[str] = [] ) -> "jinja2.Environment": - @jinja2.contextfunction + @jinja2.pass_context def url_for(context: dict, name: str, **path_params: typing.Any) -> str: request = context["request"] return request.url_for(name, **path_params) diff --git a/fatcat_scholar/templates/search.html b/fatcat_scholar/templates/search.html index 3aa2929..3adaf2f 100644 --- a/fatcat_scholar/templates/search.html +++ b/fatcat_scholar/templates/search.html @@ -43,7 +43,7 @@ </details> {% if hits %} - <span class="hit-count" style="font-size: 1.5em;">{{ babel_numbers.format_number(hits.count_found, locale=locale) }}</span> + <span class="hit-count" style="font-size: 1.5em;">{{ babel_numbers.format_decimal(hits.count_found, locale=locale) }}</span> {% trans trimmed count=hits.count_found %} Hit {% pluralize %} @@ -72,7 +72,7 @@ {% set count_size = "2.0em" %} {% endif %} <span class="hit-count" style="display: block; font-size: {{ count_size }};"> - {{ babel_numbers.format_number(hits.count_found, locale=locale) }} + {{ babel_numbers.format_decimal(hits.count_found, locale=locale) }} </span> {% trans trimmed count=hits.count_found %} Hit diff --git a/fatcat_scholar/templates/search_macros.html b/fatcat_scholar/templates/search_macros.html index 45a421d..4965045 100644 --- a/fatcat_scholar/templates/search_macros.html +++ b/fatcat_scholar/templates/search_macros.html @@ -505,9 +505,9 @@ {% endif %} <i style="padding-left: 0.5em; padding-right: 0.5em;"> - {% trans trimmed start=babel_numbers.format_number(hits.offset + 1, locale=locale), - end=babel_numbers.format_number([hits.offset + hits.limit, hits.count_found]|min, locale=locale), - total=babel_numbers.format_number(hits.count_found, locale=locale) %} + {% trans trimmed start=babel_numbers.format_decimal(hits.offset + 1, locale=locale), + end=babel_numbers.format_decimal([hits.offset + hits.limit, hits.count_found]|min, locale=locale), + total=babel_numbers.format_decimal(hits.count_found, locale=locale) %} Showing results {{ start }} — {{ end }} out of {{ total }} results {% endtrans %} </i> |