Loading django/core/checks/messages.py +2 −2 Original line number Diff line number Diff line Loading @@ -48,8 +48,8 @@ class CheckMessage(object): return "<%s: level=%r, msg=%r, hint=%r, obj=%r, id=%r>" % \ (self.__class__.__name__, self.level, self.msg, self.hint, self.obj, self.id) def is_serious(self): return self.level >= ERROR def is_serious(self, level=ERROR): return self.level >= level def is_silenced(self): from django.conf import settings Loading django/core/management/base.py +2 −2 Original line number Diff line number Diff line Loading @@ -355,7 +355,7 @@ class BaseCommand(object): translation.activate(saved_locale) def check(self, app_configs=None, tags=None, display_num_errors=False, include_deployment_checks=False): include_deployment_checks=False, fail_level=checks.ERROR): """ Uses the system check framework to validate entire Django project. Raises CommandError for any serious message (error or critical errors). Loading Loading @@ -409,7 +409,7 @@ class BaseCommand(object): len(all_issues) - visible_issue_count, ) if any(e.is_serious() and not e.is_silenced() for e in all_issues): if any(e.is_serious(fail_level) and not e.is_silenced() for e in all_issues): msg = self.style.ERROR("SystemCheckError: %s" % header) + body + footer raise SystemCheckError(msg) else: Loading django/core/management/commands/check.py +11 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,16 @@ class Command(BaseCommand): help='List available tags.') parser.add_argument('--deploy', action='store_true', dest='deploy', help='Check deployment settings.') parser.add_argument( '--fail-level', default='ERROR', choices=['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG'], dest='fail_level', help=( 'Message level that will cause the command to exit with a ' 'non-zero status. Default is ERROR.' ), ) def handle(self, *app_labels, **options): include_deployment_checks = options['deploy'] Loading Loading @@ -49,4 +59,5 @@ class Command(BaseCommand): tags=tags, display_num_errors=True, include_deployment_checks=include_deployment_checks, fail_level=getattr(checks, options['fail_level']), ) docs/ref/django-admin.txt +10 −0 Original line number Diff line number Diff line Loading @@ -147,6 +147,16 @@ Or you could run it directly on a production or staging deployment to verify that the correct settings are in use (omitting ``--settings``). You could even make it part of your integration test suite. .. django-admin-option:: --fail-level .. versionadded:: 1.10 Specifies the message level that will cause the command to exit with a non-zero status. Default is ``ERROR``. Available levels are: ``CRITICAL``, ``ERROR``, ``WARNING``, ``INFO``, and ``DEBUG``. compilemessages --------------- Loading docs/releases/1.10.txt +3 −1 Original line number Diff line number Diff line Loading @@ -150,7 +150,9 @@ Internationalization Management Commands ^^^^^^^^^^^^^^^^^^^ * ... * The new :djadminopt:`--fail-level` option of the :djadmin:`check` command allows specifying the message level that will cause the command to exit with a non-zero status. Migrations ^^^^^^^^^^ Loading Loading
django/core/checks/messages.py +2 −2 Original line number Diff line number Diff line Loading @@ -48,8 +48,8 @@ class CheckMessage(object): return "<%s: level=%r, msg=%r, hint=%r, obj=%r, id=%r>" % \ (self.__class__.__name__, self.level, self.msg, self.hint, self.obj, self.id) def is_serious(self): return self.level >= ERROR def is_serious(self, level=ERROR): return self.level >= level def is_silenced(self): from django.conf import settings Loading
django/core/management/base.py +2 −2 Original line number Diff line number Diff line Loading @@ -355,7 +355,7 @@ class BaseCommand(object): translation.activate(saved_locale) def check(self, app_configs=None, tags=None, display_num_errors=False, include_deployment_checks=False): include_deployment_checks=False, fail_level=checks.ERROR): """ Uses the system check framework to validate entire Django project. Raises CommandError for any serious message (error or critical errors). Loading Loading @@ -409,7 +409,7 @@ class BaseCommand(object): len(all_issues) - visible_issue_count, ) if any(e.is_serious() and not e.is_silenced() for e in all_issues): if any(e.is_serious(fail_level) and not e.is_silenced() for e in all_issues): msg = self.style.ERROR("SystemCheckError: %s" % header) + body + footer raise SystemCheckError(msg) else: Loading
django/core/management/commands/check.py +11 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,16 @@ class Command(BaseCommand): help='List available tags.') parser.add_argument('--deploy', action='store_true', dest='deploy', help='Check deployment settings.') parser.add_argument( '--fail-level', default='ERROR', choices=['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG'], dest='fail_level', help=( 'Message level that will cause the command to exit with a ' 'non-zero status. Default is ERROR.' ), ) def handle(self, *app_labels, **options): include_deployment_checks = options['deploy'] Loading Loading @@ -49,4 +59,5 @@ class Command(BaseCommand): tags=tags, display_num_errors=True, include_deployment_checks=include_deployment_checks, fail_level=getattr(checks, options['fail_level']), )
docs/ref/django-admin.txt +10 −0 Original line number Diff line number Diff line Loading @@ -147,6 +147,16 @@ Or you could run it directly on a production or staging deployment to verify that the correct settings are in use (omitting ``--settings``). You could even make it part of your integration test suite. .. django-admin-option:: --fail-level .. versionadded:: 1.10 Specifies the message level that will cause the command to exit with a non-zero status. Default is ``ERROR``. Available levels are: ``CRITICAL``, ``ERROR``, ``WARNING``, ``INFO``, and ``DEBUG``. compilemessages --------------- Loading
docs/releases/1.10.txt +3 −1 Original line number Diff line number Diff line Loading @@ -150,7 +150,9 @@ Internationalization Management Commands ^^^^^^^^^^^^^^^^^^^ * ... * The new :djadminopt:`--fail-level` option of the :djadmin:`check` command allows specifying the message level that will cause the command to exit with a non-zero status. Migrations ^^^^^^^^^^ Loading