Skip to content

Commit

Permalink
Conform with formencode - http://bit.ly/KDpyra
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed Jun 15, 2012
1 parent a5fa620 commit 67f8f64
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tw2/forms/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def _validate(self, value, state=None):
if not isinstance(value, (list, tuple)):
value = [value]
if self.validator:
self.validator.validate_python(self.validator.to_python(value))
self.validator.validate_python(self.validator.to_python(value, state))
if self.item_validator:
value = [twc.safe_validate(self.item_validator, v) for v in value]
self.value = [v for v in value if v is not twc.Invalid]
Expand Down Expand Up @@ -593,7 +593,7 @@ def any_content(self, val):
else:
return bool(val)

def to_python(self, value):
def to_python(self, value, state=None):
return [v for v in value if self.any_content(v)]


Expand All @@ -605,7 +605,7 @@ class GridLayout(twc.RepeatingWidget):

def _validate(self, value, state=None):
return super(GridLayout, self)._validate(
StripBlanks().to_python(value), state
StripBlanks().to_python(value, state), state
)


Expand Down

0 comments on commit 67f8f64

Please sign in to comment.