From 8acee2e626746f3096c49b3ebb13aaf7dc882917 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 19 Aug 2013 21:02:22 +0100 Subject: [PATCH] Commenting link/action decorators as pending deprecation --- rest_framework/decorators.py | 51 ++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/rest_framework/decorators.py b/rest_framework/decorators.py index 1ca176f2c..18e41a18d 100644 --- a/rest_framework/decorators.py +++ b/rest_framework/decorators.py @@ -108,6 +108,31 @@ def permission_classes(permission_classes): return decorator +def detail_route(methods=['get'], **kwargs): + """ + Used to mark a method on a ViewSet that should be routed for detail requests. + """ + def decorator(func): + func.bind_to_methods = methods + func.detail = True + func.kwargs = kwargs + return func + return decorator + + +def list_route(methods=['get'], **kwargs): + """ + Used to mark a method on a ViewSet that should be routed for list requests. + """ + def decorator(func): + func.bind_to_methods = methods + func.detail = False + func.kwargs = kwargs + return func + return decorator + +# These are now pending deprecation, in favor of `detail_route` and `list_route`. + def link(**kwargs): """ Used to mark a method on a ViewSet that should be routed for detail GET requests. @@ -133,28 +158,4 @@ def action(methods=['post'], **kwargs): func.detail = True func.kwargs = kwargs return func - return decorator - - -def detail_route(methods=['get'], **kwargs): - """ - Used to mark a method on a ViewSet that should be routed for detail requests. - """ - def decorator(func): - func.bind_to_methods = methods - func.detail = True - func.kwargs = kwargs - return func - return decorator - - -def list_route(methods=['get'], **kwargs): - """ - Used to mark a method on a ViewSet that should be routed for list requests. - """ - def decorator(func): - func.bind_to_methods = methods - func.detail = False - func.kwargs = kwargs - return func - return decorator + return decorator \ No newline at end of file