Fixed #25318 -- Made SILENCED_SYSTEM_CHECKS suppress all messages.
Previously, messages of ERROR level or higher were printed to the console.
This commit is contained in:
parent
2bb1027d6b
commit
01b2b0b654
|
@ -438,8 +438,8 @@ class BaseCommand(object):
|
||||||
debugs = [e for e in all_issues if e.level < checks.INFO and not e.is_silenced()]
|
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()]
|
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()]
|
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]
|
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]
|
criticals = [e for e in all_issues if checks.CRITICAL <= e.level and not e.is_silenced()]
|
||||||
sorted_issues = [
|
sorted_issues = [
|
||||||
(criticals, 'CRITICALS'),
|
(criticals, 'CRITICALS'),
|
||||||
(errors, 'ERRORS'),
|
(errors, 'ERRORS'),
|
||||||
|
|
|
@ -2195,8 +2195,12 @@ Default: ``[]`` (Empty list)
|
||||||
|
|
||||||
A list of identifiers of messages generated by the system check framework
|
A list of identifiers of messages generated by the system check framework
|
||||||
(i.e. ``["models.W001"]``) that you wish to permanently acknowledge and ignore.
|
(i.e. ``["models.W001"]``) that you wish to permanently acknowledge and ignore.
|
||||||
Silenced warnings will no longer be output to the console; silenced errors
|
Silenced checks will not be output to the console.
|
||||||
will still be printed, but will not prevent management commands from running.
|
|
||||||
|
.. 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.
|
See also the :doc:`/ref/checks` documentation.
|
||||||
|
|
||||||
|
|
|
@ -989,6 +989,10 @@ Miscellaneous
|
||||||
Set ``request.current_app`` to ``None`` if you don't want to use a namespace
|
Set ``request.current_app`` to ``None`` if you don't want to use a namespace
|
||||||
hint.
|
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:
|
.. _deprecated-features-1.9:
|
||||||
|
|
||||||
Features deprecated in 1.9
|
Features deprecated in 1.9
|
||||||
|
|
|
@ -232,14 +232,8 @@ class SilencingCheckTests(SimpleTestCase):
|
||||||
call_command('check', stdout=out, stderr=err)
|
call_command('check', stdout=out, stderr=err)
|
||||||
except CommandError:
|
except CommandError:
|
||||||
self.fail("The mycheck.E001 check should be silenced.")
|
self.fail("The mycheck.E001 check should be silenced.")
|
||||||
self.assertEqual(out.getvalue(), '')
|
self.assertEqual(out.getvalue(), 'System check identified no issues (1 silenced).\n')
|
||||||
self.assertEqual(
|
self.assertEqual(err.getvalue(), '')
|
||||||
err.getvalue(),
|
|
||||||
'System check identified some issues:\n\n'
|
|
||||||
'ERRORS:\n'
|
|
||||||
'?: (myerrorcheck.E001) Error\n\n'
|
|
||||||
'System check identified 1 issue (0 silenced).\n'
|
|
||||||
)
|
|
||||||
|
|
||||||
@override_settings(SILENCED_SYSTEM_CHECKS=['mywarningcheck.E001'])
|
@override_settings(SILENCED_SYSTEM_CHECKS=['mywarningcheck.E001'])
|
||||||
@override_system_checks([custom_warning_system_check])
|
@override_system_checks([custom_warning_system_check])
|
||||||
|
|
Loading…
Reference in New Issue