diff options
author | Hernan <hernan.grecco@gmail.com> | 2021-10-27 20:36:40 -0300 |
---|---|---|
committer | Hernan <hernan.grecco@gmail.com> | 2021-10-27 20:36:40 -0300 |
commit | eb4e13428a3ede09148b76c71bc5b8cddb169176 (patch) | |
tree | 45d34a62b26ccfe84ab03d5da0c8c71a8aa6f873 /pint/formatting.py | |
parent | 4ada9df8e2747086851595217df759fc3d9df5c7 (diff) | |
download | pint-eb4e13428a3ede09148b76c71bc5b8cddb169176.tar.gz |
Support for babel > 2.8develop
Close #1400, #1219 and #1296.
Diffstat (limited to 'pint/formatting.py')
-rw-r--r-- | pint/formatting.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/pint/formatting.py b/pint/formatting.py index a04205d..528f4e0 100644 --- a/pint/formatting.py +++ b/pint/formatting.py @@ -333,9 +333,14 @@ def formatter( # Don't remove this positional! This is the format used in Babel key = pat.replace("{0}", "").strip() break - division_fmt = compound_unit_patterns.get("per", {}).get( - babel_length, division_fmt - ) + + tmp = compound_unit_patterns.get("per", {}).get(babel_length, division_fmt) + + try: + division_fmt = tmp.get("compound", division_fmt) + except AttributeError: + division_fmt = tmp + power_fmt = "{}{}" exp_call = _pretty_fmt_exponent if value == 1: |