Skip to content

Commit 07f842b

Browse files
check attr on formatting
1 parent bfd3b34 commit 07f842b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

mpcontribs-api/mpcontribs/api/contributions/document.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@
3333
lambda s: s.replace("%", " percent "),
3434
],
3535
)
36-
ureg.formatter.default_format = "~,P"
36+
if hasattr(ureg,"formatter"):
37+
# for newer versions of pint
38+
ureg.formatter.default_format = "~,P"
39+
else:
40+
ureg.default_format = "~,P"
3741

3842
if "percent" not in ureg:
3943
# percent is native in pint >= 0.21

0 commit comments

Comments
 (0)