Code

Opened 7 years ago

Closed 7 years ago

Last modified 7 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 7 years ago.
Patch which allows basestring or Promise

Download all attachments as: .zip

Change History (6)

comment:1 Changed 7 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 7 years ago by ubernostrum

  • Has patch set

Changed 7 years ago by ubernostrum

Patch which allows basestring or Promise

comment:3 Changed 7 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 7 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 7 years ago by gwilson

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.