From 00a11994a57312687b9e104d2de370b139a28358 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Sat, 17 Jan 2015 12:32:20 -0500 Subject: [PATCH] Removed support for AppCommand.handle_app() per deprecation timeline. --- django/core/management/base.py | 23 +++-------------------- docs/howto/custom-management-commands.txt | 16 ---------------- 2 files changed, 3 insertions(+), 36 deletions(-) diff --git a/django/core/management/base.py b/django/core/management/base.py index b907015d08..f2301eef37 100644 --- a/django/core/management/base.py +++ b/django/core/management/base.py @@ -572,26 +572,9 @@ class AppCommand(BaseCommand): Perform the command's actions for app_config, an AppConfig instance corresponding to an application label given on the command line. """ - try: - # During the deprecation path, keep delegating to handle_app if - # handle_app_config isn't implemented in a subclass. - handle_app = self.handle_app - except AttributeError: - # Keep only this exception when the deprecation completes. - raise NotImplementedError( - "Subclasses of AppCommand must provide" - "a handle_app_config() method.") - else: - warnings.warn( - "AppCommand.handle_app() is superseded by " - "AppCommand.handle_app_config().", - RemovedInDjango19Warning, stacklevel=2) - if app_config.models_module is None: - raise CommandError( - "AppCommand cannot handle app '%s' in legacy mode " - "because it doesn't have a models module." - % app_config.label) - return handle_app(app_config.models_module, **options) + raise NotImplementedError( + "Subclasses of AppCommand must provide" + "a handle_app_config() method.") class LabelCommand(BaseCommand): diff --git a/docs/howto/custom-management-commands.txt b/docs/howto/custom-management-commands.txt index cab7ea47ac..54e7f00cd5 100644 --- a/docs/howto/custom-management-commands.txt +++ b/docs/howto/custom-management-commands.txt @@ -406,22 +406,6 @@ each application. :class:`~django.apps.AppConfig` instance corresponding to an application label given on the command line. -.. versionchanged:: 1.7 - - Previously, :class:`AppCommand` subclasses had to implement - ``handle_app(app, **options)`` where ``app`` was a models module. The new - API makes it possible to handle applications without a models module. The - fastest way to migrate is as follows:: - - def handle_app_config(app_config, **options): - if app_config.models_module is None: - return # Or raise an exception. - app = app_config.models_module - # Copy the implementation of handle_app(app_config, **options) here. - - However, you may be able to simplify the implementation by using directly - the attributes of ``app_config``. - .. class:: LabelCommand A management command which takes one or more arbitrary arguments