File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -47,10 +47,13 @@ def __get_path__(self, parent_pattern):
47
47
48
48
def __get_allowed_methods__ (self ):
49
49
callback_cls = self .callback .cls
50
- return sorted (
51
- [force_str (m ).upper () for m in callback_cls .http_method_names
52
- if hasattr (callback_cls , m ) or (issubclass (callback_cls , ModelViewSet )
53
- and m in VIEWSET_METHODS .get (self .callback .suffix , '' ))])
50
+
51
+ def is_method_allowed (method_name ):
52
+ return hasattr (callback_cls , method_name ) or (
53
+ issubclass (callback_cls , ModelViewSet ) and
54
+ method_name in VIEWSET_METHODS .get (self .callback .suffix , []))
55
+
56
+ return sorted ([force_str (name ).upper () for name in callback_cls .http_method_names if is_method_allowed (name )])
54
57
55
58
def __get_docstring__ (self ):
56
59
return inspect .getdoc (self .callback )
You can’t perform that action at this time.
0 commit comments