Skip to content

Commit 1f8f34b

Browse files
authored
Anchor related_url to beginning of request path
Closes #22.
1 parent ccc3ef9 commit 1f8f34b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: menu_generator/menu.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ def _is_selected(self, item_dict):
9191
If related URLS are given, it also returns true if one of the related URLS is part of path.
9292
"""
9393
url = self._get_url(item_dict)
94-
if self._is_root(item_dict) and url in self.path:
94+
if self._is_root(item_dict) and self.path.startswith(url):
9595
return True
9696
elif url == self.path:
9797
return True
9898
else:
9999
# Go through all related URLs and test
100100
for related_url in self._get_related_urls(item_dict):
101-
if related_url in self.path:
101+
if self.path.startswith(related_url):
102102
return True
103103
return False
104104

0 commit comments

Comments
 (0)