Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changed core.management print_help() methods to accept a prog_name ar…

…gument instead of an argv list, in an attempt to figure out why auto reloading stopped working

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6089 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit a247c726c2e6df7e7e561edd5cace7f00b76cbfd 1 parent c554858
@adrianholovaty adrianholovaty authored
Showing with 13 additions and 13 deletions.
  1. +10 −10 django/core/management/__init__.py
  2. +3 −3 django/core/management/base.py
View
20 django/core/management/__init__.py
@@ -51,11 +51,11 @@ def default_commands(self):
names = [f[:-3] for f in os.listdir(command_dir) if not f.startswith('_') and f.endswith('.py')]
return dict([(name, load_command_class(name)) for name in names])
- def print_help(self, argv):
+ def print_help(self, prog_name):
"""
Returns the help message, as a string.
"""
- prog_name = os.path.basename(argv[0])
+ prog_name = os.path.basename(prog_name)
usage = ['%s <subcommand> [options] [args]' % prog_name]
usage.append('Django command line tool, version %s' % django.get_version())
usage.append("Type '%s help <subcommand>' for help on a specific subcommand." % prog_name)
@@ -66,7 +66,7 @@ def print_help(self, argv):
usage.append(' %s' % cmd)
print '\n'.join(usage)
- def fetch_command(self, subcommand, command_name):
+ def fetch_command(self, subcommand, prog_name):
"""
Tries to fetch the given subcommand, printing a message with the
appropriate command called from the command line (usually
@@ -75,13 +75,13 @@ def fetch_command(self, subcommand, command_name):
try:
return self.commands[subcommand]
except KeyError:
- sys.stderr.write("Unknown command: %r\nType '%s help' for usage.\n" % (subcommand, command_name))
+ sys.stderr.write("Unknown command: %r\nType '%s help' for usage.\n" % (subcommand, prog_name))
sys.exit(1)
def execute(self, argv=None):
"""
- Figures out which command is being run (the first arg), creates a parser
- appropriate to that command, and runs it.
+ Given the command-line arguments, this figures out which subcommand is
+ being run, creates a parser appropriate to that command, and runs it.
"""
if argv is None:
argv = sys.argv
@@ -93,17 +93,17 @@ def execute(self, argv=None):
if subcommand == 'help':
if len(argv) > 2:
- self.fetch_command(argv[2], argv[0]).print_help(argv[2:])
+ self.fetch_command(argv[2], argv[0]).print_help(argv[0])
else:
- self.print_help(argv)
+ self.print_help(argv[0])
# Special-cases: We want 'django-admin.py --version' and
# 'django-admin.py --help' to work, for backwards compatibility.
elif argv[1:] == ['--version']:
print django.get_version()
elif argv[1:] == ['--help']:
- self.print_help(argv)
+ self.print_help(argv[0])
else:
- self.fetch_command(subcommand, argv[0]).run(argv[1:])
+ self.fetch_command(subcommand, argv[0]).run_from_argv(argv[1:])
class ProjectManagementUtility(ManagementUtility):
"""
View
6 django/core/management/base.py
@@ -49,11 +49,11 @@ def create_parser(self, prog_name):
version=self.get_version(),
option_list=self.option_list)
- def print_help(self, argv):
- parser = self.create_parser(argv[0])
+ def print_help(self, prog_name):
+ parser = self.create_parser(prog_name)
parser.print_help()
- def run(self, argv):
+ def run_from_argv(self, argv):
parser = self.create_parser(argv[0])
options, args = parser.parse_args(argv[1:])
if options.settings:
Please sign in to comment.
Something went wrong with that request. Please try again.