Skip to content

Commit

Permalink
Avoid fail when converting integer with spaces if value is not send i…
Browse files Browse the repository at this point in the history
…n unicode.
  • Loading branch information
tdesvenain committed Aug 10, 2011
1 parent 74790bb commit cc871a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CHANGES
2.4.5 (unreleased)
------------------

- Nothing changed yet.
- Avoid fail when converting integer with spaces if value is not send in unicode.


2.4.4 (2011-07-11)
Expand Down
5 changes: 4 additions & 1 deletion src/z3c/form/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ def toFieldValue(self, value):
if value == u'':
return self.field.missing_value
try:
return self.formatter.parse(value)
if type(value) is unicode:
return self.formatter.parse(value)
else:
return self.formatter.parse(unicode(value))
except zope.i18n.format.NumberParseError:
raise FormatterValidationError(self.errorMessage, value)

Expand Down

0 comments on commit cc871a8

Please sign in to comment.