File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 3
3
from django .conf import settings
4
4
from django .core .exceptions import ImproperlyConfigured
5
5
from django .urls .exceptions import Resolver404
6
- from django .urls .resolvers import URLResolver
6
+ from django .urls .resolvers import RegexPattern , RoutePattern , URLResolver
7
7
8
8
"""
9
9
All Routing instances inside this file are also valid ASGI applications - with
@@ -87,7 +87,14 @@ def __init__(self, routes):
87
87
# The inner ASGI app wants to do additional routing, route
88
88
# must not be an endpoint
89
89
if getattr (route .callback , "_path_routing" , False ) is True :
90
- route .pattern ._is_endpoint = False
90
+ pattern = route .pattern
91
+ if isinstance (pattern , RegexPattern ):
92
+ arg = pattern ._regex
93
+ elif isinstance (pattern , RoutePattern ):
94
+ arg = pattern ._route
95
+ else :
96
+ raise ValueError (f"Unsupported pattern type: { type (pattern )} " )
97
+ route .pattern = pattern .__class__ (arg , pattern .name , is_endpoint = False )
91
98
92
99
if not route .callback and isinstance (route , URLResolver ):
93
100
raise ImproperlyConfigured (
You can’t perform that action at this time.
0 commit comments