messages/_utils.py
def validate_input(msg_type, attr, value):
    """Base function to validate input, dispatched via message type."""
    try:
        valid = {
            "Email": validate_email,
            "Twilio": validate_twilio,
            "SlackWebhook": validate_slackwebhook,
            "SlackPost": validate_slackpost,
            "TelegramBot": validate_telegrambot,
            "WhatsApp": validate_whatsapp,
        }[msg_type](attr, value)
    except KeyError:
        return 1
    else:
        return 0
def validate_input(msg_type, attr, value):
    try:
        valid = {
            "Email": validate_email,
            "Twilio": validate_twilio,
            "SlackWebhook": validate_slackwebhook,
            "SlackPost": validate_slackpost,
            "TelegramBot": validate_telegrambot,
            "WhatsApp": validate_whatsapp,
        }[msg_type](attr, value)
    except KeyError:
        return 1
    else:
        return 0
def validate_input ( msg_type , attr , value ) : try : valid = { "Email" : validate_email , "Twilio" : validate_twilio , "SlackWebhook" : validate_slackwebhook , "SlackPost" : validate_slackpost , "TelegramBot" : validate_telegrambot , "WhatsApp" : validate_whatsapp , } [ msg_type ] ( attr , value ) except KeyError : return 1 else : return 0
Base function to validate input, dispatched via message type.
Base function to validate input dispatched via message type .