Bug #48551
sur validation regex TypeError: expected string or bytes-like object
Statut:
Fermé
Priorité:
Normal
Assigné à:
-
Version cible:
-
Début:
14 novembre 2020
Echéance:
% réalisé:
0%
Temps estimé:
Patch proposed:
Non
Planning:
Non
Description
Exception: type = '<class 'TypeError'>', value = 'expected string or bytes-like object' Stack trace (most recent call first): File "/usr/lib/python3.7/re.py", line 173, in match 171 """Try to apply the pattern at the start of the string, returning 172 a Match object, or None if no match was found.""" > 173 return _compile(pattern, flags).match(string) 174 175 def fullmatch(pattern, string, flags=0): locals: flags = 0 pattern = '^(?:\\d+)$' string = None File "/usr/lib/python3/dist-packages/wcs/qommon/form.py", line 1061, in regex_validation 1059 if pattern: 1060 def regex_validation(value): > 1061 return bool(re.match(r'^(?:%s)$' % pattern, value)) 1062 return regex_validation 1063 if validation['type'] == 'django' and validation.get('value'): locals: pattern = '\\d+' value = None File "/usr/lib/python3/dist-packages/wcs/qommon/form.py", line 1117, in _parse 1115 self.validation_function = ValidationWidget.get_validation_function(self.field.validation) 1116 > 1117 if self.validation_function and not self.validation_function(self.value): 1118 self.error = self.validation_function_error_message or _('invalid value') 1119 locals: request = <wcs.compat.CompatHTTPRequest object at 0x7f4c86b298d0> self = <WcsExtraStringWidget at 7f4c868c45c0: f50>
Demandes liées
Historique
Mis à jour par Frédéric Péters il y a plus de 2 ans
- Statut changé de Nouveau à Fermé
Dupliqué et corrigé en #55014.
Mis à jour par Frédéric Péters il y a plus de 2 ans
- Duplique Bug #55014: validation regex sur valeur à None ajouté