Author: adrian
Date: 2007-09-10 22:46:35 -0500 (Mon, 10 Sep 2007)
New Revision: 6089

Modified:
   django/trunk/django/core/management/__init__.py
   django/trunk/django/core/management/base.py
Log:
Changed core.management print_help() methods to accept a prog_name argument 
instead of an argv list, in an attempt to figure out why auto reloading stopped 
working

Modified: django/trunk/django/core/management/__init__.py
===================================================================
--- django/trunk/django/core/management/__init__.py     2007-09-11 02:49:07 UTC 
(rev 6088)
+++ django/trunk/django/core/management/__init__.py     2007-09-11 03:46:35 UTC 
(rev 6089)
@@ -51,11 +51,11 @@
         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 @@
             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 @@
         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 @@
 
         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):
     """

Modified: django/trunk/django/core/management/base.py
===================================================================
--- django/trunk/django/core/management/base.py 2007-09-11 02:49:07 UTC (rev 
6088)
+++ django/trunk/django/core/management/base.py 2007-09-11 03:46:35 UTC (rev 
6089)
@@ -49,11 +49,11 @@
                             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:


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to