mirror of
https://github.com/yweber/lodel2.git
synced 2025-10-21 08:39:03 +02:00
Added unit tests for the Regex datahandler
This commit is contained in:
parent
3299dc549a
commit
9ab3293538
1 changed files with 2 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
|||
import warnings
|
||||
import inspect
|
||||
from lodel.leapi.datahandlers.datas_base import *
|
||||
import re
|
||||
|
||||
##@brief Data field designed to handle formated strings
|
||||
class FormatString(Varchar):
|
||||
|
@ -46,7 +47,7 @@ max_length and regex'
|
|||
|
||||
def _check_data_value(self, value):
|
||||
error = None
|
||||
if not self.compiled_re.match(value):
|
||||
if not self.compiled_re.match(value) or len(value) > self.max_length:
|
||||
value = ''
|
||||
msg = '"%s" doesn\'t match the regex "%s"' % (value, self.regex)
|
||||
error = TypeError(msg)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue