Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Don't default to list in method args #2518

Merged
merged 3 commits into from
Feb 4, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions rest_framework/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,12 @@ def decorator(func):
return decorator


def detail_route(methods=['get'], **kwargs):
def detail_route(methods=None, **kwargs):
"""
Used to mark a method on a ViewSet that should be routed for detail requests.
"""
if methods is None:
methods = ['get']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a newline here, also let's use the methods = ['get'] if (methods is None) else methods style.

def decorator(func):
func.bind_to_methods = methods
func.detail = True
Expand All @@ -121,10 +123,12 @@ def decorator(func):
return decorator


def list_route(methods=['get'], **kwargs):
def list_route(methods=None, **kwargs):
"""
Used to mark a method on a ViewSet that should be routed for list requests.
"""
if methods is None:
methods = ['get']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a newline here, also let's use the methods = ['get'] if (methods is None) else methods style.

def decorator(func):
func.bind_to_methods = methods
func.detail = False
Expand Down