Loading docs/howto/custom-management-commands.txt +4 −3 Original line number Diff line number Diff line Loading @@ -358,7 +358,7 @@ the :meth:`~BaseCommand.handle` method must be implemented. .. admonition:: Calling a management command in your code ``execute()`` should not be called directly from your code to execute a command. Use :ref:`call_command <call-command>` instead. command. Use :func:`~django.core.management.call_command` instead. .. method:: BaseCommand.handle(*args, **options) Loading Loading @@ -439,5 +439,6 @@ message to the appropriate output stream (i.e., stderr); as a result, raising this exception (with a sensible description of the error) is the preferred way to indicate that something has gone wrong in the execution of a command. If a management command is called from code through :ref:`call_command <call-command>`, it's up to you to catch the exception when needed. If a management command is called from code through :func:`~django.core.management.call_command`, it's up to you to catch the exception when needed. docs/ref/django-admin.txt +0 −2 Original line number Diff line number Diff line Loading @@ -1746,8 +1746,6 @@ See :doc:`/howto/custom-management-commands` for how to add customized actions. Running management commands from your code ========================================== .. _call-command: .. function:: django.core.management.call_command(name, *args, **options) To call a management command from code use ``call_command``. Loading docs/releases/1.5.txt +3 −2 Original line number Diff line number Diff line Loading @@ -254,8 +254,9 @@ Django 1.5 also includes several smaller improvements worth noting: * The generic views support OPTIONS requests. * Management commands do not raise ``SystemExit`` any more when called by code from :ref:`call_command <call-command>`. Any exception raised by the command (mostly :exc:`~django.core.management.CommandError`) is propagated. from :func:`~django.core.management.call_command`. Any exception raised by the command (mostly :exc:`~django.core.management.CommandError`) is propagated. Moreover, when you output errors or messages in your custom commands, you should now use ``self.stdout.write('message')`` and Loading docs/releases/1.8.txt +8 −8 Original line number Diff line number Diff line Loading @@ -429,12 +429,12 @@ Management Commands introspect :class:`~django.db.models.AutoField` for MySQL and PostgreSQL databases. * When calling management commands from code through :ref:`call_command <call-command>` and passing options, the option name can match the command line option name (without the initial dashes) or the final option destination variable name, but in either case, the resulting option received by the command is now always the ``dest`` name specified in the command option definition (as long as the command uses the new :py:mod:`argparse` module). * When calling management commands with options using :func:`~django.core.management.call_command`, the option name can match the command line option name (without the initial dashes) or the final option destination variable name, but in either case, the resulting option received by the command is now always the ``dest`` name specified in the command option definition (as long as the command uses the :mod:`argparse` module). * The :djadmin:`dbshell` command now supports MySQL's optional SSL certificate authority setting (``--ssl-ca``). Loading Loading @@ -1124,8 +1124,8 @@ Miscellaneous class name found in the :setting:`BACKEND <CACHES-BACKEND>` key of the :setting:`CACHES` setting. * By default, :ref:`call_command <call-command>` now always skips the check framework (unless you pass it ``skip_checks=False``). * By default, :func:`~django.core.management.call_command` now always skips the check framework (unless you pass it ``skip_checks=False``). * When iterating over lines, :class:`~django.core.files.File` now uses `universal newlines`_. The following are recognized as ending a line: the Loading Loading
docs/howto/custom-management-commands.txt +4 −3 Original line number Diff line number Diff line Loading @@ -358,7 +358,7 @@ the :meth:`~BaseCommand.handle` method must be implemented. .. admonition:: Calling a management command in your code ``execute()`` should not be called directly from your code to execute a command. Use :ref:`call_command <call-command>` instead. command. Use :func:`~django.core.management.call_command` instead. .. method:: BaseCommand.handle(*args, **options) Loading Loading @@ -439,5 +439,6 @@ message to the appropriate output stream (i.e., stderr); as a result, raising this exception (with a sensible description of the error) is the preferred way to indicate that something has gone wrong in the execution of a command. If a management command is called from code through :ref:`call_command <call-command>`, it's up to you to catch the exception when needed. If a management command is called from code through :func:`~django.core.management.call_command`, it's up to you to catch the exception when needed.
docs/ref/django-admin.txt +0 −2 Original line number Diff line number Diff line Loading @@ -1746,8 +1746,6 @@ See :doc:`/howto/custom-management-commands` for how to add customized actions. Running management commands from your code ========================================== .. _call-command: .. function:: django.core.management.call_command(name, *args, **options) To call a management command from code use ``call_command``. Loading
docs/releases/1.5.txt +3 −2 Original line number Diff line number Diff line Loading @@ -254,8 +254,9 @@ Django 1.5 also includes several smaller improvements worth noting: * The generic views support OPTIONS requests. * Management commands do not raise ``SystemExit`` any more when called by code from :ref:`call_command <call-command>`. Any exception raised by the command (mostly :exc:`~django.core.management.CommandError`) is propagated. from :func:`~django.core.management.call_command`. Any exception raised by the command (mostly :exc:`~django.core.management.CommandError`) is propagated. Moreover, when you output errors or messages in your custom commands, you should now use ``self.stdout.write('message')`` and Loading
docs/releases/1.8.txt +8 −8 Original line number Diff line number Diff line Loading @@ -429,12 +429,12 @@ Management Commands introspect :class:`~django.db.models.AutoField` for MySQL and PostgreSQL databases. * When calling management commands from code through :ref:`call_command <call-command>` and passing options, the option name can match the command line option name (without the initial dashes) or the final option destination variable name, but in either case, the resulting option received by the command is now always the ``dest`` name specified in the command option definition (as long as the command uses the new :py:mod:`argparse` module). * When calling management commands with options using :func:`~django.core.management.call_command`, the option name can match the command line option name (without the initial dashes) or the final option destination variable name, but in either case, the resulting option received by the command is now always the ``dest`` name specified in the command option definition (as long as the command uses the :mod:`argparse` module). * The :djadmin:`dbshell` command now supports MySQL's optional SSL certificate authority setting (``--ssl-ca``). Loading Loading @@ -1124,8 +1124,8 @@ Miscellaneous class name found in the :setting:`BACKEND <CACHES-BACKEND>` key of the :setting:`CACHES` setting. * By default, :ref:`call_command <call-command>` now always skips the check framework (unless you pass it ``skip_checks=False``). * By default, :func:`~django.core.management.call_command` now always skips the check framework (unless you pass it ``skip_checks=False``). * When iterating over lines, :class:`~django.core.files.File` now uses `universal newlines`_. The following are recognized as ending a line: the Loading