Models - MessageBase
Description
A model for messages passed within SaWALi. This model is not derived from BaseModel and, as of this writing, does not require a database. Currently, this model is only used for validating form-to-email messages.
Properties
- qa (List, [String, String])
- A list of question-and-answer pairs used for anti-spam challenges.
- posts (Object)
- Pylons request.POST object passed by the controller.
Methods
- __init__ (posts)
- Assigns the value of `posts` and parses an external question-and-answer file if directed by the configuration file.
- _evalEmail (address)
- A helper invoked by mailmessage to see whether the visitor-supplied email address is in the correct format. Returns True or False.
- _evalQA (question_id, answer)
- A helper invoked by mailmessage to see whether the visitor provided the correct answer to the randomly-selected question.
- getQA
- Randomly selects a question from `qa`.
- mailmessage
- Validates POST information and returns a dictionary for the controller on success. Returns an error message code on failure.