Opened 8 years ago

Closed 8 years ago

#27300 closed Bug (fixed)

makemigrations --dry-run -v 3 on Python 3 writes byte string to stdout

Reported by: Markus Holtermann Owned by: Markus Holtermann
Component: Core (Management commands) Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

On Python 3 makemigrations --dry-run -v 3 outputs the content of the migration file as a byte string with b"...\n..." instead of a properly decoded unicode string.

Change History (5)

comment:1 by Markus Holtermann, 8 years ago

Has patch: set

comment:2 by Claude Paroz, 8 years ago

Easy pickings: unset
Triage Stage: UnreviewedAccepted

The fact that MigrationWriter.as_string is returning a bytestring is IMHO a violation of the general principle of decode as soon as possible, encode as late as possible, which is a good rule to follow regarding string handling. I'd rather see a patch that removes the final encode("utf8") in the as_string method.

comment:3 by Claude Paroz, 8 years ago

Here's an alternative PR.

comment:4 by Tim Graham, 8 years ago

Triage Stage: AcceptedReady for checkin

comment:5 by Claude Paroz <claude@…>, 8 years ago

Resolution: fixed
Status: assignedclosed

In 979ea95:

Fixed #27300 -- Made makemigrations --dry-run output a string (no bytes)

Thanks Markus Holtermann for the report and the review.

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