summaryrefslogtreecommitdiff
path: root/docs/howto
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2013-02-09 10:17:26 +0100
committerClaude Paroz <claude@2xlibre.net>2013-02-09 10:17:26 +0100
commit0201b9d6d89ea277383e1fc0007bfaa33351b60b (patch)
treeebd94379d05f86b41f9ff687c49ee24eca9556f0 /docs/howto
parentf44922c79516b9caf0e09fb060f20c896668b90f (diff)
Fixed #19749 -- Documented ending param to command's self.stdout/err
Thanks xian at mintchaos.com for the report.
Diffstat (limited to 'docs/howto')
-rw-r--r--docs/howto/custom-management-commands.txt8
1 files changed, 7 insertions, 1 deletions
diff --git a/docs/howto/custom-management-commands.txt b/docs/howto/custom-management-commands.txt
index bfcea64b49..7a31fc44e3 100644
--- a/docs/howto/custom-management-commands.txt
+++ b/docs/howto/custom-management-commands.txt
@@ -65,12 +65,18 @@ look like this:
self.stdout.write('Successfully closed poll "%s"' % poll_id)
+.. _management-commands-output:
+
.. note::
When you are using management commands and wish to provide console
output, you should write to ``self.stdout`` and ``self.stderr``,
instead of printing to ``stdout`` and ``stderr`` directly. By
using these proxies, it becomes much easier to test your custom
- command.
+ command. Note also that you don't need to end messages with a newline
+ character, it will be added automatically, unless you specify the ``ending``
+ parameter::
+
+ self.stdout.write("Unterminated line", ending='')
The new custom command can be called using ``python manage.py closepoll
<poll_id>``.