Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#1111 closed defect (fixed)

Documentation Error in custom validator example

Reported by: afarnham@… Owned by: Jacob
Component: Documentation Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

From the documentation as it is at the time of this bug report:

from django.core import validators, formfields

class ContactManipulator(formfields.Manipulator):
    def __init__(self):
        self.fields = (
            # ... snip fields as above ...
            formfields.EmailField(field_name="to", validator_list=[self.isValidToAddress])
        )

    def isValidToAddress(self, field_data, all_data):
        if not field_data.endswith("@example.com"):
            raise ValidationError("You can only send messages to example.com e-mail addresses.")

Calls to ValidationError be written as such:

raise validators.ValidationError(...)

ValidationError by itself is undefined.

Change History (1)

comment:1 by Adrian Holovaty, 18 years ago

Resolution: fixed
Status: newclosed

(In [1776]) Fixed #1111 -- Fixed bug in docs/forms.txt. Thanks, afarhham

Note: See TracTickets for help on using tickets.
Back to Top