Permalink
Browse files

Reversed expression order for pass_on_blank. Version bump.

  • Loading branch information...
1 parent 35c8f21 commit a90838ccd08c6913edfd74dd308027a77c30093b @wilhelm-murdoch committed Apr 20, 2012
Showing with 8 additions and 8 deletions.
  1. +1 −1 setup.py
  2. +7 −7 validator/rules.py
View
@@ -7,7 +7,7 @@
setup(
name = 'Validator',
- version = '1.0.8',
+ version = '1.0.9',
description = 'A python module used for setting up validation rules.',
author = 'Wilhelm Murdoch',
author_email = 'wilhelm.murdoch@gmail.com',
View
@@ -34,7 +34,7 @@ def run(self, field_value):
field_value str -- the value of the associated field to compare.
"""
- if not self.pass_on_blank and field_value.strip():
+ if self.pass_on_blank and not field_value.strip():
return True
if self.match != field_value:
@@ -70,7 +70,7 @@ def run(self, field_value):
field_value str -- the value of the associated field to compare
"""
- if not self.pass_on_blank and field_value.strip():
+ if self.pass_on_blank and not field_value.strip():
return True
if not self.expression:
@@ -150,7 +150,7 @@ def run(self, field_value):
field_value str -- the value of the associated field to compare
"""
- if not self.pass_on_blank and field_value.strip():
+ if self.pass_on_blank and not field_value.strip():
return True
if not field_value:
@@ -192,7 +192,7 @@ def run(self, field_value):
field_value str -- the value of the associated field to compare
"""
- if not self.pass_on_blank and field_value.strip():
+ if self.pass_on_blank and not field_value.strip():
return True
if len((field_value.strip() if self.strip else field_value)) != self.length:
@@ -239,7 +239,7 @@ def run(self, field_value):
field_value str -- the value of the associated field to compare
"""
- if not self.pass_on_blank and field_value.strip():
+ if self.pass_on_blank and not field_value.strip():
return True
if self.min <= len((field_value.strip() if self.strip else field_value)) <= self.max:
@@ -282,7 +282,7 @@ def run(self, field_value):
field_value str -- the value of the associated field to compare
"""
- if not self.pass_on_blank and field_value.strip():
+ if self.pass_on_blank and not field_value.strip():
return True
if (field_value.strip() if self.strip else field_value) not in self.list:
@@ -318,7 +318,7 @@ def run(self, field_value):
field_value str -- the value of the associated field to compare
"""
- if not self.pass_on_blank and field_value.strip():
+ if self.pass_on_blank and not field_value.strip():
return True
if not isinstance(field_value, self.type):

0 comments on commit a90838c

Please sign in to comment.