diff options
| author | Jon Dufresne <jon.dufresne@gmail.com> | 2018-12-27 11:19:55 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-12-27 11:19:55 -0500 |
| commit | 6fe9c45b725cd21eacbb50263bd3449e1a3edf17 (patch) | |
| tree | 76c94d830c0c1e17d1d7580743908eb0aacc134e /django/test | |
| parent | 293db9eb36e42e8ba976c2639800020d04b95deb (diff) | |
Fixed #30024 -- Made urlencode() and Client raise TypeError when None is passed as data.
Diffstat (limited to 'django/test')
| -rw-r--r-- | django/test/client.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/django/test/client.py b/django/test/client.py index d14ba43792..07641b7e65 100644 --- a/django/test/client.py +++ b/django/test/client.py @@ -192,7 +192,12 @@ def encode_multipart(boundary, data): # file, or a *list* of form values and/or files. Remember that HTTP field # names can be duplicated! for (key, value) in data.items(): - if is_file(value): + if value is None: + raise TypeError( + 'Cannot encode None as POST data. Did you mean to pass an ' + 'empty string or omit the value?' + ) + elif is_file(value): lines.extend(encode_file(boundary, key, value)) elif not isinstance(value, str) and is_iterable(value): for item in value: |
