summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authordaniel a rios <misterrios@gmail.com>2019-04-24 22:51:47 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-06-24 11:47:56 +0200
commit76b993a117b61c41584e95149a67d8a1e9f49dd1 (patch)
tree317074f163cacbb137ec01ff6c7f39a76dc6fcf2 /django
parentd640c71fa35640b4c13107c074be2f52c52ad861 (diff)
Fixed #26431 -- Prevented django.urls.resolve() from returning missing optional parameters.
Previous behavior was inconsistent with django.urls.reverse() and caused that translate_url() created an incorrect URL when an optional parameter was missing.
Diffstat (limited to 'django')
-rw-r--r--django/urls/resolvers.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/urls/resolvers.py b/django/urls/resolvers.py
index af0508f94e..247e3680c0 100644
--- a/django/urls/resolvers.py
+++ b/django/urls/resolvers.py
@@ -153,7 +153,7 @@ class RegexPattern(CheckURLMixin):
# If there are any named groups, use those as kwargs, ignoring
# non-named groups. Otherwise, pass all non-named arguments as
# positional arguments.
- kwargs = match.groupdict()
+ kwargs = {k: v for k, v in match.groupdict().items() if v is not None}
args = () if kwargs else match.groups()
return path[match.end():], args, kwargs
return None