On Jul 15, 6:22 pm, Seth <[email protected]> wrote:
> However, there's one last thing I keep banging my head against the
> wall over: How do I get the specific field errors to show up next to
> the fields like they were before (preferably without hacking my own

class CheckPassword(FancyValidator):
    def _to_python(self, value, state):
        # do magic
        if client.passwd != md5(value).hexdigest():
            raise Invalid(
                'That password doesn\'t match the existing password',
                value, state)
        return value

class PasswordSchema(Schema):
        chained_validators = [FieldsMatch
('password','passwordverify')]

class PasswordForm(TableForm):
    action = 'passwordsave'
    validator = PasswordSchema
    class fields(WidgetsList):
      oldpassword = PasswordField(validator=CheckPassword)
      password = PasswordField(validator=NotEmpty)
      passwordverify = PasswordField(validator=NotEmpty)

With Turbogears 2.0.1, tw.forms 0.9.3dev_20090405-py2.5, Genshi 0.5.1,
a validation error for NotEmpty shows up next to the respective line,
the chained validator error shows up next to the Passwordverify line,
an invalid CheckPassword appears next to the oldpassword line.

Likewise in the credit card one snippet posted above, if I select just
the credit card type, the Card number displays please enter a value,
both the month and year fields state Invalid Expiration Date and the
CVV number reports Invalid Credit Card Security Code length.  An
invalid length credit card number displays properly.

Offhand, I cannot get it to display improperly.
--~--~---------~--~----~------------~-------~--~----~
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