Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #17799 - Documented that the execute() method of a management c…

…ommand is not suitable for calling the command from code; call_command should be used instead. Thanks kacah222 for the report and claudep for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17629 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 3ed0b6ed64ff7a69644d1c1eacfb62b0aedadf71 1 parent fcaf8ea
Carl Meyer authored March 02, 2012
5  docs/howto/custom-management-commands.txt
@@ -243,6 +243,11 @@ the :meth:`~BaseCommand.handle` method must be implemented.
243 243
     :class:`CommandError`, intercept it and print it sensibly to
244 244
     stderr.
245 245
 
  246
+.. admonition:: Calling a management command in your code
  247
+
  248
+    ``execute()`` should not be called directly from your code to execute a
  249
+    command. Use :ref:`call_command <call-command>` instead.
  250
+
246 251
 .. method:: BaseCommand.handle(*args, **options)
247 252
 
248 253
     The actual logic of the command. Subclasses must implement this method.
2  docs/ref/django-admin.txt
@@ -1490,6 +1490,8 @@ See :doc:`/howto/custom-management-commands` for how to add customized actions.
1490 1490
 Running management commands from your code
1491 1491
 ==========================================
1492 1492
 
  1493
+.. _call-command:
  1494
+
1493 1495
 .. function:: django.core.management.call_command(name, *args, **options)
1494 1496
 
1495 1497
 To call a management command from code use ``call_command``.

0 notes on commit 3ed0b6e

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