mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	[1.11.x] Fixed #27887 -- Fixed URLs check crash with namespaced URLs inside non-namespaced URLs.
Backport of b23d264046 from master
			
			
This commit is contained in:
		| @@ -63,7 +63,10 @@ def _load_all_namespaces(resolver, parents=()): | ||||
|         if getattr(url, 'namespace', None) is not None | ||||
|     ] | ||||
|     for pattern in url_patterns: | ||||
|         current = parents + (getattr(pattern, 'namespace', ()),) | ||||
|         namespace = getattr(pattern, 'namespace', None) | ||||
|         current = parents | ||||
|         if namespace is not None: | ||||
|             current += (namespace,) | ||||
|         namespaces.extend(_load_all_namespaces(pattern, current)) | ||||
|     return namespaces | ||||
|  | ||||
|   | ||||
| @@ -15,4 +15,6 @@ urlpatterns = [ | ||||
|     # 'nested' is included twice but namespaced by nested-1 and nested-2. | ||||
|     url(r'^app-ns1-2/', include(nested_url_patterns, namespace='nested-1')), | ||||
|     url(r'^app-ns1-3/', include(nested_url_patterns, namespace='nested-2')), | ||||
|     # namespaced URLs inside non-namespaced URLs. | ||||
|     url(r'^app-ns1-4/', include([url(r'^abc/', include(common_url_patterns))])), | ||||
| ] | ||||
|   | ||||
		Reference in New Issue
	
	Block a user