Skip to content

DjangoModelPermissions and DjangoObjectPermissions issue on "non allowed method" #4927

@tdruez

Description

@tdruez

This issue is a side effect of the Permissions classes:

The permission code is called in the initial() method https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/views.py#L471 , just before the request method validation https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/views.py#L474

Steps to reproduce

Enable rest_framework.permissions.DjangoModelPermissions on a ViewSet and submit any Method Not Allowed, one that is not in that dict: https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/permissions.py#L90

Expected behavior

A proper "405 Method Not Allowed" as returned by https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/views.py#L474

Actual behavior

"500 Internal Server Error"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy