Fix the _verifyInt() and verifyFloating() functions for test validation

This commit is contained in:
AndyGrant committed 2020-03-21 10:11:23 -04:00
1 parent 753242948b
commit 3933e4980b
1 file changed
+4 -6
+4 -6
View File
@@ -129,14 +129,12 @@ def verifyNewTest(request):
errors = []
def verifyInteger(field, fieldName):
if not request.POST[field].isnumeric():
errors.append('{0} is not an Integer'.format(fieldName))
try: int(request.POST[field])
except: errors.append('{0} is not an Integer'.format(fieldName))
def verifyFloating(field, fieldName):
if not request.POST[field].replace('.','').isnumeric():
errors.append('{0} is not a Float'.format(fieldName))
elif request.POST[field].count('.') > 1:
errors.append('{0} is not a Float'.format(fieldName))
try: float(request.POST[field])
except: errors.append('{0} is not a Floating Point'.format(fieldName))
def verifyLessThan(field, fieldName, value, valueName):
if not float(request.POST[field]) < value: