Adjust comments

This commit is contained in:
Carlton Gibson 2017-09-05 10:00:53 +02:00
parent ef9e5f20c8
commit 96c39e5c82

View File

@ -368,9 +368,7 @@ class AutoSchema(ViewInspector):
else: else:
sections[current_section] += '\n' + line sections[current_section] += '\n' + line
# TODO: coerce_method_names is used both here and by SchemaGenerator in # TODO: SCHEMA_COERCE_METHOD_NAMES appears here and in `SchemaGenerator.get_keys`
# get_keys. It is read straight from the setting (i.e. it's not dynamic.)
# ???: Can it be a module level constant (or callable)?
coerce_method_names = api_settings.SCHEMA_COERCE_METHOD_NAMES coerce_method_names = api_settings.SCHEMA_COERCE_METHOD_NAMES
header = getattr(view, 'action', method.lower()) header = getattr(view, 'action', method.lower())
if header in sections: if header in sections:
@ -518,11 +516,14 @@ class AutoSchema(ViewInspector):
return None return None
# TODO: Where should this live? # Note: With `AutoSchema` defined we attach it to APIView.
# - We import APIView here. So we can't import the descriptor into `views` # * We do this here to avoid the dependency cycle from SchemaView needing
# - APIView is only used by SchemaView. # APIView (below).
# - ???: Make `schemas` a package and move SchemaView to `schema.views` # * This requires importing _something_ from `rest_framework.schemas` or
# - That way the schema attribute could be set in the class definition. # `rest_framework.documentation` before `APIView.schema will be available.
# * ???: When would `APIView.schema` be needed and that NOT be the case?
# * The alternative is to import AutoSchema to `views`, make `schemas` a
# package, and move SchemaView to `schema.views`, importing APIView there.
APIView.schema = AutoSchema() APIView.schema = AutoSchema()