summaryrefslogtreecommitdiff
path: root/django/urls
diff options
context:
space:
mode:
Diffstat (limited to 'django/urls')
-rw-r--r--django/urls/base.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/django/urls/base.py b/django/urls/base.py
index 3899feeefb..6cf75d3a3f 100644
--- a/django/urls/base.py
+++ b/django/urls/base.py
@@ -145,13 +145,12 @@ def get_urlconf(default=None):
def is_valid_path(path, urlconf=None):
"""
- Return True if the given path resolves against the default URL resolver,
- False otherwise. This is a convenience method to make working with "is
- this a match?" cases easier, avoiding try...except blocks.
+ Return the ResolverMatch if the given path resolves against the default URL
+ resolver, False otherwise. This is a convenience method to make working
+ with "is this a match?" cases easier, avoiding try...except blocks.
"""
try:
- resolve(path, urlconf)
- return True
+ return resolve(path, urlconf)
except Resolver404:
return False