﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
269	Patch: validator that matches against a regular expression	hugo <gb@…>	Adrian Holovaty	"For some cases it's easies to have a validator that just matches against some given regular expression:

{{{
class MatchesRegularExpression:
    def __init__(self, regexp, error_message=""The format for this field is wrong""):
        self.regexp = regexp
        self.error_message = error_message

    def __call__(self, field_data, all_data):
        if not self.regexp.match(field_data):
            raise validators.ValidationError(self.error_message)
}}}

This is actually a validator factory that produces the validator on instantiation."	enhancement	closed	contrib.admin		normal	fixed			Unreviewed	0	0	0	0	0	0
