Skip to content

Commit

Permalink
Handled long type numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunga001 committed Jan 9, 2025
1 parent 99a6d85 commit ae00d48
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/bika/cement/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ def format_number(value, decimal_places=2):
if value in (None, ""):
return None

if isinstance(value, int):
return value # Return as-is if it's an integer
if isinstance(value, (int, long)):
try:
return int(value) # Return as-is if it's an integer
except OverflowError:
return value

try:
num = float(value)
Expand Down

0 comments on commit ae00d48

Please sign in to comment.