diff options
| author | Tom Christie | 2015-02-04 14:30:53 +0000 |
|---|---|---|
| committer | Tom Christie | 2015-02-04 14:30:53 +0000 |
| commit | 3b008245605d608e6a21d46f35994b8dc6bc12ed (patch) | |
| tree | 9ad3b5ce4b6d4768a29ac3379fd5ef1875c776ff | |
| parent | d21617ff3bc39114a8d9cb75666158e80f1242d0 (diff) | |
| parent | e13d2af1374c8a2b2146e1126d9406bfb4bbd9ec (diff) | |
| download | django-rest-framework-3b008245605d608e6a21d46f35994b8dc6bc12ed.tar.bz2 | |
Merge pull request #2518 from longhotsummer/patch-1
FIX: Don't default to list in method args
| -rw-r--r-- | rest_framework/decorators.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/rest_framework/decorators.py b/rest_framework/decorators.py index 325435b3..21de1acf 100644 --- a/rest_framework/decorators.py +++ b/rest_framework/decorators.py @@ -18,8 +18,7 @@ def api_view(http_method_names=None): Decorator that converts a function-based view into an APIView subclass. Takes a list of allowed methods for the view as an argument. """ - if http_method_names is None: - http_method_names = ['GET'] + http_method_names = ['GET'] if (http_method_names is None) else http_method_names def decorator(func): @@ -109,10 +108,12 @@ def permission_classes(permission_classes): 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. """ + methods = ['get'] if (methods is None) else methods + def decorator(func): func.bind_to_methods = methods func.detail = True @@ -121,10 +122,12 @@ def detail_route(methods=['get'], **kwargs): 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. """ + methods = ['get'] if (methods is None) else methods + def decorator(func): func.bind_to_methods = methods func.detail = False |
