Code

Opened 17 months ago

Closed 17 months ago

Last modified 17 months 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 claudep 17 months ago.
19749-2.diff (1.7 KB) - added by claudep 17 months ago.
Mention the ending parameter

Download all attachments as: .zip

Change History (11)

comment:1 Changed 17 months ago by anonymous

  • Needs documentation set
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 17 months ago by claudep

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 17 months ago by aaugustin

  • Severity changed from Normal to Release blocker

Changed 17 months ago by claudep

comment:4 Changed 17 months ago by claudep

  • Has patch set
  • Needs documentation unset

Does the attached patch seem sufficient?

comment:5 Changed 17 months ago by xian@…

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.

Changed 17 months ago by claudep

Mention the ending parameter

comment:6 Changed 17 months ago by claudep

Is this one better?

comment:7 Changed 17 months ago by apollo13

Looks good to me, ship it :)

comment:8 Changed 17 months ago by Claude Paroz <claude@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 0201b9d6d89ea277383e1fc0007bfaa33351b60b:

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

Thanks xian at mintchaos.com for the report.

comment:9 Changed 17 months ago by Claude Paroz <claude@…>

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.