Skip to content

Commit

Permalink
Back to 2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxim Avanov committed Sep 14, 2012
1 parent ac845eb commit 3a0ce73
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions formencode/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def _to_python(self, value_dict, state):
state.key = name
try:
new[name] = validator.to_python(value, state)
except Invalid as e:
except Invalid, e:
errors[name] = e

for name in unused:
Expand All @@ -216,7 +216,7 @@ def _to_python(self, value_dict, state):
state.key = name
try:
new[name] = validator.to_python(self.if_key_missing, state)
except Invalid as e:
except Invalid, e:
errors[name] = e
else:
new[name] = validator.if_missing
Expand All @@ -229,7 +229,7 @@ def _to_python(self, value_dict, state):
continue
try:
validator.validate_partial(value_dict, state)
except Invalid as e:
except Invalid, e:
sub_errors = e.unpack_errors()
if not isinstance(sub_errors, dict):
# Can't do anything here
Expand Down Expand Up @@ -285,7 +285,7 @@ def _from_python(self, value_dict, state):
state.key = name
try:
new[name] = self.fields[name].from_python(value, state)
except Invalid as e:
except Invalid, e:
errors[name] = e

del __traceback_info__
Expand All @@ -296,7 +296,7 @@ def _from_python(self, value_dict, state):
state.key = name
try:
new[name] = validator.from_python(None, state)
except Invalid as e:
except Invalid, e:
errors[name] = e

if errors:
Expand Down
8 changes: 4 additions & 4 deletions tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test(self):
print repr(self.raw_input)
try:
print repr(self.schema.to_python(self.input))
except Invalid as e:
except Invalid, e:
actual = e.unpack_errors()
assert actual == self.output
else:
Expand Down Expand Up @@ -175,11 +175,11 @@ def test_multiple_chained_validators_errors():
s = ChainedTest()
try:
s.to_python({'a':'1', 'a_confirm':'2', 'b':'3', 'b_confirm':'4'})
except Invalid as e:
except Invalid, e:
assert 'a_confirm' in e.error_dict and 'b_confirm' in e.error_dict
try:
s.to_python({})
except Invalid as e:
except Invalid:
pass
else:
assert False
Expand Down Expand Up @@ -271,7 +271,7 @@ def test_Schema_with_input_missing(self):
# <input type="checkbox" name="agree" value="yes">
try:
self.schema.to_python({})
except Invalid as exc:
except Invalid, exc:
error_message = exc.error_dict['agree'].msg
assert self.not_empty_messages['missing'] == error_message, \
error_message
Expand Down

0 comments on commit 3a0ce73

Please sign in to comment.