PY-11855 Run manage.py task improvements
authorIlya.Kazakevich <Ilya.Kazakevich@jetbrains.com>
Mon, 16 Feb 2015 22:33:33 +0000 (01:33 +0300)
committerIlya.Kazakevich <Ilya.Kazakevich@jetbrains.com>
Mon, 16 Feb 2015 22:33:33 +0000 (01:33 +0300)
Workaround to support errors:
* In Python side we skip command if it is misconfigured
* On Java side we skip producer if it fails
 TODO: we need to log errors on python side somehow

python/helpers/pycharm/django_manage_commands_provider/_optparse.py

index 69e54d4db9b42e3887ad8e265daf1342eeaeff6e..1ef84ab96dd27566ddb8f57d5e5af15c1a77fefa 100644 (file)
@@ -6,6 +6,7 @@ This module encapsulates Django semi-public API knowledge, and not very stable b
 from optparse import Option
 import django
 from django.conf import settings
+from django.core.exceptions import ImproperlyConfigured
 from django.core.management import ManagementUtility, get_commands, BaseCommand
 
 __author__ = 'Ilya.Kazakevich'
@@ -20,7 +21,11 @@ def report_data(dumper):
     """
     utility = ManagementUtility()
     for command_name in get_commands().keys():
-        command = utility.fetch_command(command_name)
+        try:
+            command = utility.fetch_command(command_name)
+        except ImproperlyConfigured:
+            continue # TODO: Log somehow
+
         assert isinstance(command, BaseCommand)
         dumper.start_command(command_name=command_name,
                              command_help_text=str(command.usage("").replace("%prog", command_name)),