Skip to content

Commit

Permalink
fix: regex validator if no value is specific
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncoulton committed Jun 7, 2017
1 parent bf69653 commit a2dbd24
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion watson/validators/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
__version__ = '1.0.2'
__version__ = '1.0.3'

try:
# Fix for setup.py version import
Expand Down
2 changes: 1 addition & 1 deletion watson/validators/string.py
Expand Up @@ -98,7 +98,7 @@ def __init__(self, regex, flags=0,
self.message = message

def __call__(self, value, **kwargs):
if not self.regex.match(value):
if not value or value and not self.regex.match(value):
raise ValueError(
self.message.format(
value=value,
Expand Down

0 comments on commit a2dbd24

Please sign in to comment.