Skip to content

Commit

Permalink
[ro] Strip field in order to avoid int conversion crash
Browse files Browse the repository at this point in the history
If the CIF ended with a space the validation crashed with this error:
invalid literal for int() with base 10: ''
  • Loading branch information
viorels authored and claudep committed Jun 24, 2015
1 parent 9abf18c commit cbff146
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion localflavor/ro/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def clean(self, value):
"""
CIF validation
"""
value = super(ROCIFField, self).clean(value)
value = super(ROCIFField, self).clean(value).strip()
if value in EMPTY_VALUES:
return ''
# strip RO part
Expand Down
1 change: 1 addition & 0 deletions tests/test_ro.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def test_ROCIFField(self):
error_atleast = ['Ensure this value has at least 2 characters (it has 1).']
valid = {
'21694681': '21694681',
'21694681 ': '21694681',
'RO21694681': '21694681',
}
invalid = {
Expand Down

0 comments on commit cbff146

Please sign in to comment.