diff options
| author | swatantra <swatantra.kumar8@gmail.com> | 2019-08-09 13:49:18 +0530 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-08-11 20:15:23 +0200 |
| commit | 73ac9e3f04c4a1a6b1add05c207d11c8ff461b7d (patch) | |
| tree | c748a1de5869e45f2bf0f9c0149150d802cd6b6b /django/utils/http.py | |
| parent | c1b26c77a94c13b350d80e9a2f8d0393dee737cd (diff) | |
Fixed #30677 -- Improved error message for urlencode() and Client when None is passed as data.
Diffstat (limited to 'django/utils/http.py')
| -rw-r--r-- | django/utils/http.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/django/utils/http.py b/django/utils/http.py index b6a78184a6..050375832c 100644 --- a/django/utils/http.py +++ b/django/utils/http.py @@ -113,8 +113,8 @@ def urlencode(query, doseq=False): for key, value in query: if value is None: raise TypeError( - 'Cannot encode None in a query string. Did you mean to pass ' - 'an empty string or omit the value?' + "Cannot encode None for key '%s' in a query string. Did you " + "mean to pass an empty string or omit the value?" % key ) elif not doseq or isinstance(value, (str, bytes)): query_val = value @@ -130,8 +130,9 @@ def urlencode(query, doseq=False): for item in itr: if item is None: raise TypeError( - 'Cannot encode None in a query string. Did you ' - 'mean to pass an empty string or omit the value?' + "Cannot encode None for key '%s' in a query " + "string. Did you mean to pass an empty string or " + "omit the value?" % key ) elif not isinstance(item, bytes): item = str(item) |
