def get_valid_input(self, context, input_, type_, max_length, allow_none, error_list=None):
     rvr = StringValidationRule( type_, self.encoder )
     pattern = ESAPI.security_configuration().get_validation_pattern(type_)
     if pattern is not None:
         rvr.add_whitelist_pattern(pattern)
     else:
         rvr.add_whitelist_pattern(type_)
         
     rvr.set_maximum_length(max_length)
     rvr.set_allow_none(allow_none)
     return rvr.get_valid(context, input_, error_list)
Beispiel #2
0
    def get_valid_input(self,
                        context,
                        input_,
                        type_,
                        max_length,
                        allow_none,
                        error_list=None):
        rvr = StringValidationRule(type_, self.encoder)
        pattern = ESAPI.security_configuration().get_validation_pattern(type_)
        if pattern is not None:
            rvr.add_whitelist_pattern(pattern)
        else:
            rvr.add_whitelist_pattern(type_)

        rvr.set_maximum_length(max_length)
        rvr.set_allow_none(allow_none)
        return rvr.get_valid(context, input_, error_list)