Skip to content

Commit

Permalink
Fix an issue with flagged_path and includes
Browse files Browse the repository at this point in the history
This change fixes an issue with `flagged_path` where `includes()` would not be correctly included, and cannot be resolved using their names.

The issue was simply with our passing of `is_endpoint` to the pattern class. In the case of `path()` URLs, the pattern class is `RoutePattern`, and it doesn’t double-check `is_endpoint` the way `RegexPattern` does. I have some more details in #100.

This is a simple fix to change that incorrect `True` to `False`.
  • Loading branch information
willbarton committed May 17, 2022
1 parent f4eb045 commit f956917
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions flags/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class FlaggedURLResolver(URLResolver):
def __init__(
self,
flag_name,
regex,
pattern,
urlconf_name,
default_kwargs=None,
app_name=None,
Expand All @@ -24,7 +24,7 @@ def __init__(
fallback=None,
):
super(FlaggedURLResolver, self).__init__(
regex,
pattern,
urlconf_name,
default_kwargs=default_kwargs,
app_name=app_name,
Expand All @@ -39,7 +39,7 @@ def __init__(
if isinstance(self.fallback, (list, tuple)):
urlconf_module, app_name, namespace = self.fallback
self.fallback_patterns = URLResolver(
regex,
pattern,
urlconf_module,
None,
app_name=app_name,
Expand Down Expand Up @@ -78,6 +78,7 @@ def url_patterns(self):
pattern.default_args,
pattern.name,
)
print(pattern, flagged_pattern)

url_patterns.append(flagged_pattern)

Expand Down Expand Up @@ -127,7 +128,7 @@ def _flagged_path(
elif isinstance(view, (list, tuple)):
urlconf_module, app_name, namespace = view

route_pattern = Pattern(route, name=name, is_endpoint=True)
route_pattern = Pattern(route, name=name, is_endpoint=False)

return FlaggedURLResolver(
flag_name,
Expand Down

0 comments on commit f956917

Please sign in to comment.