Exemple #1
0
def validate_idnum(id):
    if id is not None:
        if not isValid_num(id):
            return response.build_validation_result(
                False, 'loginId', 'Please re-enter a valid id')

    return response.build_validation_result(True, None, None)
Exemple #2
0
def validate_web(id):
    if id is not None:
        if not isValid_numf(id):
            return response.build_validation_result(
                False, 'bussWeb', 'Please enter your website')

    return response.build_validation_result(True, None, None)
Exemple #3
0
def validate_adress(id):
    if id is not None:
        if not isValid_numf(id):
            return response.build_validation_result(
                False, 'busAddr', 'Please enter your Business Address')

    return response.build_validation_result(True, None, None)
Exemple #4
0
def validate_email(id):
    if id is not None:
        if not isValid_numf(id):
            return response.build_validation_result(
                False, 'comId', 'Please enter a valid email')

    return response.build_validation_result(True, None, None)
Exemple #5
0
def validate_app(id):
    if id is not None:
        if not isValid_numf(id):
            return response.build_validation_result(
                False, 'appState', 'Please enter either yes or no')

    return response.build_validation_result(True, None, None)
Exemple #6
0
def validate_job(id, id1):
    if id is not None:
        if not isValid_numf(id):
            return response.build_validation_result(
                False, 'jobOpenWeb', 'Please enter your job openings link')
    if id1 is not None:
        if not isValid_numf(id1):
            return response.build_validation_result(
                False, 'jobOpenEmail', 'Please enter a valid email id')

    return response.build_validation_result(True, None, None)
Exemple #7
0
def validate_dis(id, id1):
    if id is not None:
        if not isValid_numf(id):
            return response.build_validation_result(
                False, 'offName', 'Please enter your discount offer')
    if id1 is not None:
        if not isValid_numf(id1):
            return response.build_validation_result(
                False, 'offCode', 'Please enter a discount code')

    return response.build_validation_result(True, None, None)
Exemple #8
0
def validate_time(t1, t2):

    if t1 is not None:
        if len(t1) != 5:
            # Not a valid time; use a prompt defined on the build-time model.
            return build_validation_result(False, 'openTime', None)

        hour, minute = t1.split(':')
        hour = parse_int(hour)
        minute = parse_int(minute)
        if math.isnan(hour) or math.isnan(minute):
            # Not a valid time; use a prompt defined on the build-time model.
            return build_validation_result(False, 'openTime', None)
    if t2 is not None:
        if len(t2) != 5:
            # Not a valid time; use a prompt defined on the build-time model.
            return build_validation_result(False, 'closeTime', None)

        hour, minute = t2.split(':')
        hour = parse_int(hour)
        minute = parse_int(minute)
        if math.isnan(hour) or math.isnan(minute):
            # Not a valid time; use a prompt defined on the build-time model.
            return build_validation_result(False, 'closeTime', None)

    return response.build_validation_result(True, None, None)