Commit 01b2b0b6 authored by Tim Graham's avatar Tim Graham
Browse files

Fixed #25318 -- Made SILENCED_SYSTEM_CHECKS suppress all messages.

Previously, messages of ERROR level or higher were printed to
the console.
parent 2bb1027d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -438,8 +438,8 @@ class BaseCommand(object):
            debugs = [e for e in all_issues if e.level < checks.INFO and not e.is_silenced()]
            infos = [e for e in all_issues if checks.INFO <= e.level < checks.WARNING and not e.is_silenced()]
            warnings = [e for e in all_issues if checks.WARNING <= e.level < checks.ERROR and not e.is_silenced()]
            errors = [e for e in all_issues if checks.ERROR <= e.level < checks.CRITICAL]
            criticals = [e for e in all_issues if checks.CRITICAL <= e.level]
            errors = [e for e in all_issues if checks.ERROR <= e.level < checks.CRITICAL and not e.is_silenced()]
            criticals = [e for e in all_issues if checks.CRITICAL <= e.level and not e.is_silenced()]
            sorted_issues = [
                (criticals, 'CRITICALS'),
                (errors, 'ERRORS'),
+6 −2
Original line number Diff line number Diff line
@@ -2195,8 +2195,12 @@ Default: ``[]`` (Empty list)

A list of identifiers of messages generated by the system check framework
(i.e. ``["models.W001"]``) that you wish to permanently acknowledge and ignore.
Silenced warnings will no longer be output to the console; silenced errors
will still be printed, but will not prevent management commands from running.
Silenced checks will not be output to the console.

.. versionchanged:: 1.9

    In older versions, silenced messages of ``ERROR`` level or higher were
    printed to the console.

See also the :doc:`/ref/checks` documentation.

+4 −0
Original line number Diff line number Diff line
@@ -989,6 +989,10 @@ Miscellaneous
  Set ``request.current_app`` to ``None`` if you don't want to use a namespace
  hint.

* The :setting:`SILENCED_SYSTEM_CHECKS` setting now silences messages of all
  levels. Previously, messages of ``ERROR`` level or higher were printed to the
  console.

.. _deprecated-features-1.9:

Features deprecated in 1.9
+2 −8
Original line number Diff line number Diff line
@@ -232,14 +232,8 @@ class SilencingCheckTests(SimpleTestCase):
            call_command('check', stdout=out, stderr=err)
        except CommandError:
            self.fail("The mycheck.E001 check should be silenced.")
        self.assertEqual(out.getvalue(), '')
        self.assertEqual(
            err.getvalue(),
            'System check identified some issues:\n\n'
            'ERRORS:\n'
            '?: (myerrorcheck.E001) Error\n\n'
            'System check identified 1 issue (0 silenced).\n'
        )
        self.assertEqual(out.getvalue(), 'System check identified no issues (1 silenced).\n')
        self.assertEqual(err.getvalue(), '')

    @override_settings(SILENCED_SYSTEM_CHECKS=['mywarningcheck.E001'])
    @override_system_checks([custom_warning_system_check])