Ticket #29365: base.py.patch

File base.py.patch, 1.3 KB (added by blins, 7 years ago)

patch

Line 
1*** /django/urls/base.py 2018-04-27 10:43:41.776882217 +0500
2--- base.py 2018-04-27 10:39:46.198032905 +0500
3***************
4*** 82,87 ****
5--- 82,108 ----
6 )
7 else:
8 raise NoReverseMatch("%s is not a registered namespace" % key)
9+ else:
10+ if current_path:
11+ current_path.reverse()
12+ resolver_chain = [('', resolver)]
13+ while current_path:
14+ current_ns = current_path.pop()
15+ try:
16+ extra, resolver = resolver.namespace_dict[current_ns]
17+ resolver_chain.append((extra, resolver))
18+ except:
19+ pass
20+ while resolver_chain:
21+ extra, resolver = resolver_chain.pop()
22+ try:
23+ resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
24+ while resolver_chain:
25+ ns_pattern = extra + ns_pattern
26+ extra, __resolver = resolver_chain.pop()
27+ ns_pattern = extra + ns_pattern
28+ except:
29+ pass
30 if ns_pattern:
31 resolver = get_ns_resolver(ns_pattern, resolver)
32
Back to Top