Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #9158 -- Changed django-admin.py help to be printed to stdout i…

…nstead of stderr, so that it's more easily greppable. Thanks, petr.marhoun@gmail.com

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15921 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 471c9aee9771da32b942e71c7dcaef97a4c70f1c 1 parent 5d85460
Adrian Holovaty authored March 26, 2011
4  django/core/management/__init__.py
@@ -365,7 +365,7 @@ def execute(self):
365 365
                 self.fetch_command(args[2]).print_help(self.prog_name, args[2])
366 366
             else:
367 367
                 parser.print_lax_help()
368  
-                sys.stderr.write(self.main_help_text() + '\n')
  368
+                sys.stdout.write(self.main_help_text() + '\n')
369 369
                 sys.exit(1)
370 370
         # Special-cases: We want 'django-admin.py --version' and
371 371
         # 'django-admin.py --help' to work, for backwards compatibility.
@@ -374,7 +374,7 @@ def execute(self):
374 374
             pass
375 375
         elif self.argv[1:] in (['--help'], ['-h']):
376 376
             parser.print_lax_help()
377  
-            sys.stderr.write(self.main_help_text() + '\n')
  377
+            sys.stdout.write(self.main_help_text() + '\n')
378 378
         else:
379 379
             self.fetch_command(subcommand).run_from_argv(self.argv)
380 380
 
4  tests/regressiontests/admin_scripts/tests.py
@@ -1113,7 +1113,7 @@ def test_help(self):
1113 1113
             self.assertOutput(out, "usage: manage.py subcommand [options] [args]")
1114 1114
         else:
1115 1115
             self.assertOutput(out, "Usage: manage.py subcommand [options] [args]")
1116  
-        self.assertOutput(err, "Type 'manage.py help <subcommand>' for help on a specific subcommand.")
  1116
+        self.assertOutput(out, "Type 'manage.py help <subcommand>' for help on a specific subcommand.")
1117 1117
 
1118 1118
     def test_short_help(self):
1119 1119
         "-h is handled as a short form of --help"
@@ -1123,7 +1123,7 @@ def test_short_help(self):
1123 1123
             self.assertOutput(out, "usage: manage.py subcommand [options] [args]")
1124 1124
         else:
1125 1125
             self.assertOutput(out, "Usage: manage.py subcommand [options] [args]")
1126  
-        self.assertOutput(err, "Type 'manage.py help <subcommand>' for help on a specific subcommand.")
  1126
+        self.assertOutput(out, "Type 'manage.py help <subcommand>' for help on a specific subcommand.")
1127 1127
 
1128 1128
     def test_specific_help(self):
1129 1129
         "--help can be used on a specific command"

0 notes on commit 471c9ae

Please sign in to comment.
Something went wrong with that request. Please try again.