Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Updated validate_form error message.
Browse files Browse the repository at this point in the history
  • Loading branch information
cesrom committed Jan 23, 2020
1 parent db6dfd6 commit e0fba4d
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions python/incendium/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,30 +93,25 @@ def validate_form(strings=None, numbers=None, collections=None):
for key, value in strings.iteritems():
if not value:
counter += 1
if counter == 1:
error_message += constants.TABBED_LINE + key
else:
error_message += constants.NEW_TABBED_LINE + key
error_message += (constants.TABBED_LINE + key
if counter == 1 else
constants.NEW_TABBED_LINE + key)
is_valid = False
if numbers:
for key, value in numbers.iteritems():
if value is None or value <= 0:
counter += 1
if counter == 1:
error_message += constants.TABBED_LINE + key
else:
error_message += constants.NEW_TABBED_LINE + key
error_message += (constants.TABBED_LINE + key
if counter == 1 else
constants.NEW_TABBED_LINE + key)
is_valid = False
if collections:
for key, value in collections.iteritems():
if value is None or value <= 0:
counter += 1
error_message += (constants.TABBED_LINE + key if counter == 1
else constants.NEW_TABBED_LINE + key)
if counter == 1:
error_message += constants.TABBED_LINE + key
else:
error_message += constants.NEW_TABBED_LINE + key
error_message += (constants.TABBED_LINE + key
if counter == 1 else
constants.NEW_TABBED_LINE + key)
is_valid = False

return is_valid, error_message

0 comments on commit e0fba4d

Please sign in to comment.