Skip to content

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

Closed
@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