Opened 6 years ago

Closed 6 years ago

#15795 closed Bug (fixed)

[patch] __repr__ for RegexURLPattern not unicode safe

Reported by: Mark Raddatz <mraddatz@…> Owned by: nobody
Component: Core (Other) Version: 1.3
Severity: Normal Keywords: debug unicode
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: yes UI/UX:

Description

An instance of RegexURLPattern is returned by the url() function, which can be used as an argument to patterns() for the URLConf. The url arguments for regex and name could contain unicode. However, the __repr__ function handle this data as bytestring and could raise a UnicodeDecodeError: 'ascii' codec can't decode byte. RegexURLResolver should be affected too.

Attachments (1)

urlresolvers-r16022.diff (898 bytes) - added by Mark Raddatz <mraddatz@…> 6 years ago.
Patch that adds smart_str to the repr() function.

Download all attachments as: .zip

Change History (5)

Changed 6 years ago by Mark Raddatz <mraddatz@…>

Attachment: urlresolvers-r16022.diff added

Patch that adds smart_str to the repr() function.

comment:1 Changed 6 years ago by Carl Meyer

Easy pickings: unset
Needs tests: set
Triage Stage: UnreviewedAccepted

comment:2 Changed 6 years ago by Carl Meyer

Easy pickings: set

comment:3 Changed 6 years ago by Jannis Leidel

Triage Stage: AcceptedReady for checkin

comment:4 Changed 6 years ago by Luke Plant

Resolution: fixed
Status: newclosed

In [16158]:

Fixed #15795 - __repr__ for RegexURLPattern not unicode safe

Thanks to Mark Raddatz for the report and patch

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