Skip to content

Commit

Permalink
Anchor related_url to beginning of request path
Browse files Browse the repository at this point in the history
  • Loading branch information
Natureshadow authored Nov 16, 2020
1 parent ccc3ef9 commit 1f8f34b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions menu_generator/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ def _is_selected(self, item_dict):
If related URLS are given, it also returns true if one of the related URLS is part of path.
"""
url = self._get_url(item_dict)
if self._is_root(item_dict) and url in self.path:
if self._is_root(item_dict) and self.path.startswith(url):
return True
elif url == self.path:
return True
else:
# Go through all related URLs and test
for related_url in self._get_related_urls(item_dict):
if related_url in self.path:
if self.path.startswith(related_url):
return True
return False

Expand Down

0 comments on commit 1f8f34b

Please sign in to comment.