Example. Not a good example, but it works.

class LoginAuth(FormValidator):
    messages = {
        'failed': 'Email or password incorrect'
    }
    validate_partial_form = True

    def validate_partial(self, value, state):
        if not (value.has_key('email_address') and
value.has_key('password')):
            return

        self.validate_python(value, state)

    def validate_python(self, value, state):
        results = User.select(User.q.email ==
value.get('email_address',''))
        if results.count() != 1:
            raise Invalid(dict(password="Your password (or email
address) was incorrect"), value, state)

        if results[0].password !=
User.hash_password(value.get('password','')):
            raise Invalid(dict(password="Your password (or email
address) was incorrect"), value, state)
        return value


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to