﻿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
266	Patch: a validator that matches against another list if some other field has a specific value	hugo <gb@…>	Adrian Holovaty	"This validator will match a field against a list of validators, but only if some other field matches some specific value. Possible usage scenario: a web interface for domain records where A records will require an IP in dotted notation while an CNAME record will require a fully qualified host name.

{{{
class MatchesIfOtherFieldEquals:
    def __init__(self, other_field, other_value, validator_list=[]):
        self.other_field = other_field
        self.other_value = other_value
        self.validator_list = validator_list
        self.always_test = True

    def __call__(self, field_data, all_data):
        if all_data.has_key(self.other_field) and all_data[self.other_field] == self.other_value:
            for v in self.validator_list:
                v(field_data, all_data)             
}}}
"	enhancement	closed	Core (Other)		normal	fixed			Unreviewed	0	0	0	0	0	0
