Opened 9 years ago

Last modified 9 years ago

#25730 closed Cleanup/optimization

base.Model __str__ sometimes returns unicode on Python 2 — at Initial Version

Reported by: Kevin Turner Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

base.py contains from __future__ import unicode_literals

so the thing that Model.__str__ returns is a unicode object in the case where hasattr(self, '__unicode__') is False.

There's a force_text().encode() on the other case; probably both cases should use smart_str.

Discovered under Django 1.7 but this looks to still be the case in the master branch.

Change History (0)

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