Code

Opened 2 years ago

Closed 10 months ago

#18719 closed Cleanup/optimization (fixed)

django.utils.encoding.smart_unicode/smart_str handle strings_only inconsistently

Reported by: aaugustin Owned by: aaugustin
Component: Utilities Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

smart_unicode calls is_protected_type, smart_str just checks for None and int.

It seems to me that smart_str should rely on is_protected_type too, for consistency.

If there's a reason for implementing a different check, it should be at least explained in a comment.

Attachments (0)

Change History (4)

comment:1 Changed 23 months ago by claudep

  • Triage Stage changed from Unreviewed to Accepted

+1 to use is_protected_type in force_bytes

comment:2 Changed 16 months ago by aaugustin

  • Component changed from Core (Other) to Utilities

comment:3 Changed 16 months ago by aaugustin

  • Owner changed from nobody to aaugustin
  • Status changed from new to assigned

comment:4 Changed 10 months ago by Aymeric Augustin <aymeric.augustin@…>

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

In e492ab8e7eb5fc2c1d4a50669aeaa3d6163dc5f3:

Fixed #18719 -- Made force_bytes more consistent with force_text.

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.