Skip to content

Commit

Permalink
feat: support for string formatting of values
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Horton <paul.horton@owasp.org>
  • Loading branch information
madpah committed Sep 12, 2022
1 parent 3fefe22 commit 99b8f3e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion serializable/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def _as_xml(self: _T, as_string: bool = True, element_name: Optional[str] = None
else:
# Handle properties that have a type that is not a Python Primitive (e.g. int, float, str)
if prop_info.string_format:
ElementTree.SubElement(this_e, new_key).text = f'{str(v):{prop_info.string_format}}'
ElementTree.SubElement(this_e, new_key).text = f'{v:{prop_info.string_format}}'
else:
ElementTree.SubElement(this_e, new_key).text = str(v)
elif prop_info.concrete_type in (float, int):
Expand Down

0 comments on commit 99b8f3e

Please sign in to comment.