Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#5370 closed (fixed)

newforms.ValidationError cannot accept a message created by ugettext_lazy

Reported by: ubernostrum 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 ubernostrum 8 years ago.
Patch which allows basestring or Promise

Download all attachments as: .zip

Change History (6)

comment:1 Changed 8 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:2 Changed 8 years ago by ubernostrum

  • Has patch set

Changed 8 years ago by ubernostrum

Patch which allows basestring or Promise

comment:3 Changed 8 years ago by ubernostrum

  • Summary changed from newforms.ValidationError cannot be accept a message created by ugettext_lazy to newforms.ValidationError cannot accept a message created by ugettext_lazy

(fix typo in summary)

comment:4 Changed 8 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:5 Changed 8 years ago by gwilson

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

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