391 | | if data and self.maxlength and len(data.decode(settings.DEFAULT_CHARSET)) > self.maxlength: |
392 | | raise validators.ValidationError, ngettext("Ensure your text is less than %s character.", |
393 | | "Ensure your text is less than %s characters.", self.maxlength) % self.maxlength |
| 391 | data_length = len(data.decode(settings.DEFAULT_CHARSET)) |
| 392 | if data and self.maxlength and data_length > self.maxlength: |
| 393 | raise validators.ValidationError, ngettext("Ensure your text is less than %s character (it is %s).", |
| 394 | "Ensure your text is less than %s characters (it is %s).", self.maxlength) % (self.maxlength, data_length) |