Skip to content

Commit 299a9b2

Browse files
authored
Merge pull request #7 from mtb-beta/fix-message-error
Bugfix: ugettext_lazy takes exactly 1 argument
2 parents 3c1f45e + 8e42ca2 commit 299a9b2

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

snowpenguin/django/recaptcha3/fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def clean(self, values):
5454
if bool(json_response['success']):
5555
if self._score_threshold is not None and self._score_threshold > json_response['score']:
5656
raise ValidationError(
57-
_('reCaptcha score is too low. score:%s', json_response['score'])
57+
_('reCaptcha score is too low. score:%s' % json_response['score'])
5858
)
5959
return values[0]
6060
else:

snowpenguin/django/recaptcha3/tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class RecaptchaTestForm(Form):
4141
recaptcha = ReCaptchaField(score_threshold=0.7)
4242
form = RecaptchaTestForm({"g-recaptcha-response": "dummy token"})
4343
self.assertFalse(form.is_valid())
44+
self.assertEqual(form.errors['recaptcha'][0], 'reCaptcha score is too low. score:0.5')
4445

4546
@mock.patch('requests.post')
4647
def test_validate_success_highter_score(self, requests_post):

0 commit comments

Comments
 (0)