Description
In src/core/urls.py, the URL pattern for the me_hotsite view uses a capturing regex group (me|ME), which causes Django to pass the captured string as a positional argument to the view. The view signature accepts this via _, but this creates fragility: if the regex is ever changed to stop capturing, the view will break. Using a non-capturing group is the correct approach.
Location
File: src/core/urls.py and src/core/views/static_views.py
Branch: develop
Current Code
# urls.py
re_path(
r"^(me|ME)\/?$", # Capturing group — passes match to view
me_hotsite,
name="mitologia-extendida",
)
# static_views.py
def me_hotsite(request, _): # Accepts the captured group via _
return render(request, "core/ME/hotsite.html", {})
Problem
The regex (me|ME) captures the matched string and Django passes it as a positional argument to me_hotsite. The view accepts it silently using _, but:
- The captured value is never used — it's unnecessary.
- If the URL pattern is refactored to remove the capturing group (e.g.,
(?:me|ME)), the view signature (request, _) will break with a TypeError.
- This pattern is inconsistent with Django best practices, which recommend non-capturing groups for URL matching.
Suggested Fix
Use a non-capturing group in the URL regex and remove the extra parameter from the view:
# urls.py
re_path(
r"^(?:me|ME)\/?$",
me_hotsite,
name="mitologia-extendida",
)
# static_views.py
def me_hotsite(request):
return render(request, "core/ME/hotsite.html", {})
Severity
Low — Currently works, but fragile and inconsistent with Django best practices.
Description
In
src/core/urls.py, the URL pattern for theme_hotsiteview uses a capturing regex group(me|ME), which causes Django to pass the captured string as a positional argument to the view. The view signature accepts this via_, but this creates fragility: if the regex is ever changed to stop capturing, the view will break. Using a non-capturing group is the correct approach.Location
File:
src/core/urls.pyandsrc/core/views/static_views.pyBranch:
developCurrent Code
Problem
The regex
(me|ME)captures the matched string and Django passes it as a positional argument tome_hotsite. The view accepts it silently using_, but:(?:me|ME)), the view signature(request, _)will break with aTypeError.Suggested Fix
Use a non-capturing group in the URL regex and remove the extra parameter from the view:
Severity
Low — Currently works, but fragile and inconsistent with Django best practices.