python-drafthorse icon indicating copy to clipboard operation
python-drafthorse copied to clipboard

DecimalElement.__str__() doesn't always return string type

Open heeplr opened this issue 2 months ago • 0 comments

A DecimalElement's value can be set to a decimal.Decimal type but it's __str__() method doesn't convert the return value. This can cause __str__() return a non-string type, which is a bug.

I'm using jinja to render the drafthorse document (as SSOT without any shadow model) and for DecimalElements it fails with:

TypeError: __str__ returned non-string (type decimal.Decimal)

This can be worked around by accessing the private _value directly but should be easy to fix. (Will prepare a PR)

heeplr avatar Nov 05 '25 10:11 heeplr