Opened 9 years ago
Closed 9 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 , 9 years ago
| Has patch: | set |
|---|
comment:2 by , 9 years ago
| Easy pickings: | unset |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
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:4 by , 9 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
Note:
See TracTickets
for help on using tickets.
PR: https://github.com/django/django/pull/7326