What do you think about adding a ValidationError similar to
CriticalValidationError but one that would stop further evaluation of
_all_ validators in the manipulator instead of just the remaining
validators for the current form field being processed?

For example, I have a simple login form with username and password that
authenticates to an LDAP server.  If the user does not have cookies
enabled, they fail the hasCookiesEnabled validator on username.
However, even if I make hasCookiesEnabled raise a
CriticalValidationError, the password validators will still get run and
my LDAP server will still get hit.  A more desirable outcome would be
for me to be able to short circuit processing of all other validators
if hasCookiesEnabled fails.

A very similar situation can been seen in
django.contrib.auth.forms.AuthenticationForm:

class AuthenticationForm(forms.Manipulator):
    def __init__(self, request=None):
        self.request = request
        self.fields = [
            forms.TextField(field_name="username", length=15,
maxlength=30, is_required=True,
                validator_list=[self.isValidUser,
self.hasCookiesEnabled]),
            forms.PasswordField(field_name="password", length=15,
maxlength=30, is_required=True,
                validator_list=[self.isValidPasswordForUser]),
        ]

Even if username's hasCookiesEnabled validator raised
CriticalValidationError, the password's isValidPasswordForUser
validator would still get run and hit the database.

One issue would be what to name this
more-critical-than-CriticalValidationError validation error.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to