I have a control structure that looks something like this:
entries = [
{'sql_col' : 'name', 'display_text' : 'Enter your name: '},
{'sql_col' : 'email', 'display_text' : 'Enter your email: '},
{'sql_col' : 'zip', 'display_text' : 'Enter your Zip Code: '},
]
Each entry in the entries list represents a text box that a user will fill in a dialog box. I would like to be able to specify a validation function for each input within that structure, i.e.:
entries = [
{'sql_col' : 'name', ... , 'validate' : lambda x: return is_name_valid(x)},
{'sql_col' : 'email', ... , 'validate' : lambda x: return is_email_valid(x)},
...
]
Problem is I can't figure out the right syntax to use for something like this. Is my entries syntax correct? How would I call the validation function later in the code and pass it the user's input as a parameter?
Also, best answer is one where I don't need to install any new modules -- I don't have sufficient privileges on the system i'm using to do any installations.