From 21d8175242273a2371bd9374994bacdd118309d3 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Mon, 3 Mar 2014 19:16:19 +0800 Subject: [PATCH] Fixed #22193 -- Made hint a truly optional arugment on check messages. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to Thomas Güttler for the suggestion. --- django/core/checks/messages.py | 2 +- docs/topics/checks.txt | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/django/core/checks/messages.py b/django/core/checks/messages.py index bda3ff9a5c..2528d11def 100644 --- a/django/core/checks/messages.py +++ b/django/core/checks/messages.py @@ -15,7 +15,7 @@ CRITICAL = 50 @python_2_unicode_compatible 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." self.level = level self.msg = msg diff --git a/docs/topics/checks.txt b/docs/topics/checks.txt index cf262811e6..aabebd1db2 100644 --- a/docs/topics/checks.txt +++ b/docs/topics/checks.txt @@ -78,12 +78,8 @@ Constructor arguments are: ``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 - value of ``None`` can be used:: - - Error('error message') # Will not work. - Error('error message', None) # Good - Error('error message', hint=None) # Better + can be provided, or the hint is self-evident from the error message, the + hint can be omitted, or a value of ``None`` can be used. ``obj`` Optional. An object providing context for the message (for example, the