#32468: Admin never_cache decorators needs method_decorator
-----------------------------------------+------------------------ Reporter: hakib | Owner: nobody Type: Bug | Status: new Component: contrib.admin | Version: 3.1 Severity: Normal | Keywords: admin Triage Stage: Unreviewed | Has patch: 0 Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -----------------------------------------+------------------------ The login and logout views in Django's admin site are using the `never_cache` decorator, but they are both instance methods, so they need to use the method_decorator. This is not a bug because the `never_cache` decorator is only operating on the response. The first argument to the decorator is supposed to be the request, but it is in-fact the admin_site instance (`self`). All the arguments are then passed to the view function and the decorator operate on the response. If you try to use a different decorator that uses the request (such as `required_http_methods`) you will fail. AttributeError: 'CustomAdminSite' object has no attribute 'method' Related issue from long time ago: https://code.djangoproject.com/ticket/18923 -- Ticket URL: <https://code.djangoproject.com/ticket/32468> 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 [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/048.ccb928fdd04021bb9045d6b21d9db5a0%40djangoproject.com. |
#32468: Admin never_cache decorators needs method_decorator
-------------------------------+------------------------------------ Reporter: hakib | Owner: nobody Type: Bug | Status: new Component: contrib.admin | Version: 3.1 Severity: Normal | Resolution: Keywords: admin | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 1 | UI/UX: 0 -------------------------------+------------------------------------ Changes (by Mariusz Felisiak): * easy: 0 => 1 * stage: Unreviewed => Accepted Comment: Thanks for the report. -- Ticket URL: <https://code.djangoproject.com/ticket/32468#comment:1> 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 [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/063.1bb7e268a40fc951874970268bba183b%40djangoproject.com. |
In reply to this post by Django
#32468: Admin never_cache decorators needs method_decorator
-------------------------------+------------------------------------ Reporter: hakib | Owner: hakib Type: Bug | Status: assigned Component: contrib.admin | Version: 3.1 Severity: Normal | Resolution: Keywords: admin | Triage Stage: Accepted Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 1 | UI/UX: 0 -------------------------------+------------------------------------ Changes (by Mariusz Felisiak): * owner: nobody => hakib * status: new => assigned * has_patch: 0 => 1 Comment: [https://github.com/django/django/pull/14030 PR] -- Ticket URL: <https://code.djangoproject.com/ticket/32468#comment:2> 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 [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/063.47db0f2057f95b0dae57ad4c74a9dd80%40djangoproject.com. |
In reply to this post by Django
#32468: Admin never_cache decorators needs method_decorator
-------------------------------------+------------------------------------- Reporter: hakib | Owner: hakib Type: Bug | Status: assigned Component: contrib.admin | Version: 3.1 Severity: Normal | Resolution: Keywords: admin | Triage Stage: Ready for | checkin Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 1 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by Mariusz Felisiak): * stage: Accepted => Ready for checkin -- Ticket URL: <https://code.djangoproject.com/ticket/32468#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 [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/063.d028400ee7be6d04ef8a2e1694f8fb0e%40djangoproject.com. |
In reply to this post by Django
#32468: Admin never_cache decorators needs method_decorator
-------------------------------------+------------------------------------- Reporter: hakib | Owner: hakib Type: Bug | Status: closed Component: contrib.admin | Version: 3.1 Severity: Normal | Resolution: fixed Keywords: admin | Triage Stage: Ready for | checkin Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 1 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by Mariusz Felisiak <felisiak.mariusz@…>): * status: assigned => closed * resolution: => fixed Comment: In [changeset:"63bbfa9f4501425f4bdabe05a79132a22dfbeb5a" 63bbfa9f]: {{{ #!CommitTicketReference repository="" revision="63bbfa9f4501425f4bdabe05a79132a22dfbeb5a" Fixed #32468 -- Corrected usage of never_cache in contrib.admin. }}} -- Ticket URL: <https://code.djangoproject.com/ticket/32468#comment:4> 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 [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/063.c628d4b1188ffd81845d5c37d350e5b6%40djangoproject.com. |
In reply to this post by Django
#32468: Admin never_cache decorators needs method_decorator
-------------------------------------+------------------------------------- Reporter: hakib | Owner: hakib Type: Bug | Status: closed Component: contrib.admin | Version: 3.1 Severity: Normal | Resolution: fixed Keywords: admin | Triage Stage: Ready for | checkin Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 1 | UI/UX: 0 -------------------------------------+------------------------------------- Comment (by Mariusz Felisiak <felisiak.mariusz@…>): In [changeset:"3fd82a62415e748002435e7bad06b5017507777c" 3fd82a62]: {{{ #!CommitTicketReference repository="" revision="3fd82a62415e748002435e7bad06b5017507777c" Refs #32468 -- Added error message on invalid usage of cache decorators. }}} -- Ticket URL: <https://code.djangoproject.com/ticket/32468#comment:5> 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 [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/063.c40fccdc2e21b39e11d2f55aebf99088%40djangoproject.com. |
Free forum by Nabble | Edit this page |