-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
The DebugToolbarMiddleware.__call__ method contains seemingly superfluous comments that might be simplified - tough may be trivial - for better readability.
django-debug-toolbar/debug_toolbar/middleware.py
Lines 128 to 133 in 0136ff9
| def __call__(self, request: HttpRequest) -> HttpResponse: | |
| # Decide whether the toolbar is active for this request. | |
| if self.async_mode: | |
| return self.__acall__(request) | |
| # Decide whether the toolbar is active for this request. | |
| show_toolbar = get_show_toolbar(async_mode=self.async_mode) |
Considering that DebugToolbarMiddleware.__acall__ (the async one just beneath) also includes the same comment:
django-debug-toolbar/debug_toolbar/middleware.py
Lines 153 to 155 in 0136ff9
| async def __acall__(self, request: HttpRequest) -> HttpResponse: | |
| # Decide whether the toolbar is active for this request. | |
| show_toolbar = get_show_toolbar(async_mode=self.async_mode) |
A change to something like this might be more concise:
def __call__(self, request: HttpRequest) -> HttpResponse:
# Decide whether the toolbar is active for this request.
if self.async_mode:
return self.__acall__(request)
show_toolbar = get_show_toolbar(async_mode=self.async_mode)I'm keen to creating a PR, but I would appreciate what others think before trying to revert something that may be intended in the first place for some reason.
Metadata
Metadata
Assignees
Labels
No labels