Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#19749 closed Cleanup/optimization (fixed)

Documentation needed: stdout.write line endings in management commands changed.

Reported by: xian@… Owned by: nobody
Component: Core (Management commands) Version: 1.5-beta-1
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

This commit changed the default behavior of stdout.write() for management commands it add "\n" endings unless otherwise specified.
https://github.com/django/django/commit/822d6d6dabc959532fb2904376580e8947c519f6

I haven't seen anything about this in the 1.5 documentation / changes and it requires code changes if you have any sort of output that relies on the old behavior.

Attachments (2)

19749-1.diff (1.4 KB ) - added by Claude Paroz 12 years ago.
19749-2.diff (1.7 KB ) - added by Claude Paroz 12 years ago.
Mention the ending parameter

Download all attachments as: .zip

Change History (11)

comment:1 by anonymous, 12 years ago

Needs documentation: set

comment:2 by Claude Paroz, 12 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Aymeric Augustin, 12 years ago

Severity: NormalRelease blocker

by Claude Paroz, 12 years ago

Attachment: 19749-1.diff added

comment:4 by Claude Paroz, 12 years ago

Has patch: set
Needs documentation: unset

Does the attached patch seem sufficient?

comment:5 by xian@…, 12 years ago

I don't think it addresses the issue correctly. The fact that newlines are added is part of it, but I had to dig through the code to figure out how to _stop_ having newlines.

self.stdout.write("A message.\n") still works exactly the same after the change. But self.stdout.write("A message.") gets a \n tacked on.

The problem for me came because I was using self.stdout.write(".") to show progress on a single line like a progress bar. I had to replace that with: self.stdout.write(".", ending="") to fix it.

by Claude Paroz, 12 years ago

Attachment: 19749-2.diff added

Mention the ending parameter

comment:6 by Claude Paroz, 12 years ago

Is this one better?

comment:7 by Florian Apolloner, 12 years ago

Looks good to me, ship it :)

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

Resolution: fixed
Status: newclosed

In 0201b9d6d89ea277383e1fc0007bfaa33351b60b:

Fixed #19749 -- Documented ending param to command's self.stdout/err

Thanks xian at mintchaos.com for the report.

comment:9 by Claude Paroz <claude@…>, 12 years ago

In 2d53799ca6674de39b5d3ac66c28b434d079725c:

[1.5.x] Fixed #19749 -- Documented ending param to command's self.stdout/err

Thanks xian at mintchaos.com for the report.
Backport of 0201b9d6d from master

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