From 94808d7eb2ae097f27a2a7b12a37c01523dc7721 Mon Sep 17 00:00:00 2001 From: sol HYUN Date: Fri, 24 Mar 2017 15:37:01 +0900 Subject: [PATCH] apply custom action Change to more accurate word and apply custom action --- rest_framework/schemas.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/rest_framework/schemas.py b/rest_framework/schemas.py index 9b48226ad..65b10588e 100644 --- a/rest_framework/schemas.py +++ b/rest_framework/schemas.py @@ -327,15 +327,14 @@ class SchemaGenerator(object): if not self.has_view_permissions(path, method, view): continue link = self.get_link(path, method, view) - typical_path = self.make_typical_path(path) - keys = self.get_keys(path, typical_path, method, view) + overall = self.make_overall(path) + keys = self.get_keys(path, overall, method, view) insert_into(links, keys, link) return links # Methods used when we generate a view instance from the raw callback... - - def make_typical_path(self, path): + def make_overall(self, path): """ Removes '/' from path and returns a linked value using '-'. """ @@ -343,7 +342,6 @@ class SchemaGenerator(object): if partial and '{' not in partial ] return '-'.join(ret) - def create_view(self, callback, method, request=None): """ Given a callback, return an actual view instance. @@ -590,7 +588,7 @@ class SchemaGenerator(object): # Method for generating the link layout.... - def get_keys(self, path, subpath, method, view): + def get_keys(self, path, overall, method, view): """ Return a list of keys that should be used to layout a link within the schema document. @@ -614,7 +612,7 @@ class SchemaGenerator(object): named_path_components = [ component for component - in subpath.strip('/').split('/') + in overall.strip('/').split('/') if '{' not in component ] @@ -626,8 +624,8 @@ class SchemaGenerator(object): action = self.coerce_method_names[action] return named_path_components + [action] else: + named_path_components = overall.split('-') return named_path_components[:-1] + [action] - if action in self.coerce_method_names: action = self.coerce_method_names[action]