Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#5370 closed (fixed)

newforms.ValidationError cannot accept a message created by ugettext_lazy

Reported by: James Bennett Owned by: nobody
Component: Internationalization Version: master
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Currently, if ugettext_lazy is used on the error message passed to the newforms ValidationError it will raise AssertionError because the message is expected to be either a list or a basestring. The assertion should instead allow for an instance of django.utils.functional.Promise (as the oldforms ValidationError already does).

Attachments (1)

5370.diff (860 bytes) - added by James Bennett 9 years ago.
Patch which allows basestring or Promise

Download all attachments as: .zip

Change History (6)

comment:1 Changed 9 years ago by Malcolm Tredinnick

Triage Stage: UnreviewedReady for checkin

comment:2 Changed 9 years ago by James Bennett

Has patch: set

Changed 9 years ago by James Bennett

Attachment: 5370.diff added

Patch which allows basestring or Promise

comment:3 Changed 9 years ago by James Bennett

Summary: newforms.ValidationError cannot be accept a message created by ugettext_lazynewforms.ValidationError cannot accept a message created by ugettext_lazy

(fix typo in summary)

comment:4 Changed 9 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(In [6140]) Fixed #5370 -- Allow lazy translations in ValidationError classes. Patch from James Bennett.

comment:5 Changed 9 years ago by Gary Wilson

(In [6150]) Refs #5370 -- Added tests for ValidationError messages.

Note: See TracTickets for help on using tickets.
Back to Top