diff options
| author | Carlton Gibson <carlton.gibson@noumenal.es> | 2020-10-20 09:14:48 +0200 |
|---|---|---|
| committer | Carlton Gibson <carlton@noumenal.es> | 2020-10-22 14:15:19 +0200 |
| commit | ad11f5b8c9cbfdb763e08c83170694abc0c5fc1e (patch) | |
| tree | 28647127cf0bc05120bee7417609ec997a5b1f96 /django/urls | |
| parent | 34180922380cf41cd684f846ecf00f92eb289bcf (diff) | |
Fixed #32124 -- Added per-view opt-out for APPEND_SLASH behavior.
Diffstat (limited to 'django/urls')
| -rw-r--r-- | django/urls/base.py | 9 |
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 |
