#35720: Problem with getattr Handling in _resolve_lookup Method
---------------------------------+--------------------------------------
Reporter: Mohammad Salehi | Owner: (none)
Type: Bug | Status: closed
Component: Template system | Version: dev
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Comment (by Mohammad Salehi):
Thanks for your response. I understand the need for a clear display of the
issue. The problem I discovered is directly related to the test you wrote
for issue #35673.
In the original code, there was an infinite loop caused by the way
request.GET was accessed. In `views/debug.py`:
{{{
c["request_GET_items"] = self.request.items()
}}}
I resolved this issue by modifying the code to:
{{{
c["request_GET_items"] = self.request.META.get("QUERY_STRING", "")
}}}
This fix breaks the loop and allows the program to continue execution.
However, after this change, another issue became apparent in the
_resolve_lookup method when the code encounters GET during the lookup
process.
Specifically, the issue arises here in `template/base.py` in line 893:
{{{
current = getattr(current, bit)
}}}
When bit is GET, getattr fails to handle it correctly, leading to an
error. This seems to be the root cause of the problem that needs
addressing.
I believe that fixing the loop in the original test (issue #35673) will
allow us to reproduce on this getattr error. It would be great to discuss
with the team whether we should modify getattr to handle this scenario
better or if we need to address the issue in another part of the code.
It way is you see this error.
--
Ticket URL: <https://code.djangoproject.com/ticket/35720#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070191b7345833-b97cd05c-a4af-4f8a-a3a1-8fdeb129acb4-000000%40eu-central-1.amazonses.com.