Fixed #22193 -- Made hint a truly optional arugment on check messages.
Thanks to Thomas Güttler for the suggestion.
This commit is contained in:
parent
5679fce87c
commit
21d8175242
|
@ -15,7 +15,7 @@ CRITICAL = 50
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class CheckMessage(object):
|
class CheckMessage(object):
|
||||||
|
|
||||||
def __init__(self, level, msg, hint, obj=None, id=None):
|
def __init__(self, level, msg, hint=None, obj=None, id=None):
|
||||||
assert isinstance(level, int), "The first argument should be level."
|
assert isinstance(level, int), "The first argument should be level."
|
||||||
self.level = level
|
self.level = level
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
|
|
|
@ -78,12 +78,8 @@ Constructor arguments are:
|
||||||
|
|
||||||
``hint``
|
``hint``
|
||||||
A single-line string providing a hint for fixing the problem. If no hint
|
A single-line string providing a hint for fixing the problem. If no hint
|
||||||
can be provided, or the hint is self-evident from the error message, a
|
can be provided, or the hint is self-evident from the error message, the
|
||||||
value of ``None`` can be used::
|
hint can be omitted, or a value of ``None`` can be used.
|
||||||
|
|
||||||
Error('error message') # Will not work.
|
|
||||||
Error('error message', None) # Good
|
|
||||||
Error('error message', hint=None) # Better
|
|
||||||
|
|
||||||
``obj``
|
``obj``
|
||||||
Optional. An object providing context for the message (for example, the
|
Optional. An object providing context for the message (for example, the
|
||||||
|
|
Loading…
Reference in New Issue