From 2bb335bcfba5a213525362ab72605ab8008a1855 Mon Sep 17 00:00:00 2001 From: forest Date: Tue, 14 Dec 2021 01:47:45 -0600 Subject: [PATCH] fix type coercion special case where dollars = 0 --- capsulflask/payment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/capsulflask/payment.py b/capsulflask/payment.py index d2ce0d6..3977979 100644 --- a/capsulflask/payment.py +++ b/capsulflask/payment.py @@ -39,9 +39,9 @@ def validate_dollars(min: float, max: float): #current_app.logger.info(f"{str(dollars)} {str(min)} {str(dollars < min)}") - if dollars and dollars < min: + if dollars is not None and dollars < min: errors.append(f"dollars must be {format(min, '.2f')} or more") - elif dollars and dollars >= max: + elif dollars is not None and dollars >= max: errors.append(f"dollars must be less than {format(max, '.2f')}") current_app.logger.info(f"{len(errors)} {errors}")