Commit 5e442317 authored by Vincent Ardisson's avatar Vincent Ardisson Committed by Romain Bignon

weboob.tools.value: Value's regexp must now match until end of string

Many modules do not have the "$" in Values regexps, and it's almost
always a mistake.
parent f062a566
......@@ -102,7 +102,7 @@ class Value(object):
raise ValueError('Value is required and thus must be set')
if v == '' and self.default != '' and (self.choices is None or v not in self.choices):
raise ValueError('Value can\'t be empty')
if self.regexp is not None and not re.match(self.regexp, unicode(v)):
if self.regexp is not None and not re.match(self.regexp + '$', unicode(v)):
raise ValueError('Value "%s" does not match regexp "%s"' % (self.show_value(v), self.regexp))
if self.choices is not None and v not in self.choices:
raise ValueError('Value "%s" is not in list: %s' % (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment