Skip to content

Commit 06df61e

Browse files
resalisburytomchristie
authored andcommitted
handle error when no links are found (encode#4649)
This is to address tomchristie/django-rest-raml#5 The problem is that if you try to generate RAML docs when you haven't set up any views, you get the above error (min called on an empty list). unfortunately, this PR is not very helpful since it doesn't actually surface a readable error to the user. Not sure what the best way to address this would be...
1 parent ee60aaa commit 06df61e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

rest_framework/schemas.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@ def get_links(self, request=None):
263263
view_endpoints.append((path, method, view))
264264

265265
# Only generate the path prefix for paths that will be included
266+
if not paths:
267+
return None
266268
prefix = self.determine_path_prefix(paths)
267269

268270
for path, method, view in view_endpoints:

0 commit comments

Comments
 (0)