From 07349597ab936dc9887caa70b5d7d2860c897b12 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Thu, 29 Dec 2011 13:31:12 +0000 Subject: whitespace fixes --- djangorestframework/utils/description.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'djangorestframework/utils/description.py') diff --git a/djangorestframework/utils/description.py b/djangorestframework/utils/description.py index 25bef80b..ce61e558 100644 --- a/djangorestframework/utils/description.py +++ b/djangorestframework/utils/description.py @@ -10,7 +10,7 @@ from djangorestframework.resources import Resource, FormResource, ModelResource def get_name(view): """ Return a name for the view. - + If view has a name attribute, use that, otherwise use the view's class name, with 'CamelCaseNames' converted to 'Camel Case Names'. """ @@ -22,7 +22,7 @@ def get_name(view): # If this view has a resource that's been overridden, then use that resource for the name if getattr(view, 'resource', None) not in (None, Resource, FormResource, ModelResource): name = view.resource.__name__ - + # Chomp of any non-descriptive trailing part of the resource class name if name.endswith('Resource') and name != 'Resource': name = name[:-len('Resource')] @@ -30,7 +30,7 @@ def get_name(view): # If the view has a descriptive suffix, eg '*** List', '*** Instance' if getattr(view, '_suffix', None): name += view._suffix - + # Otherwise if it's a function view use the function's name elif getattr(view, '__name__', None) is not None: name = view.__name__ @@ -62,12 +62,12 @@ def get_description(view): # grok the class instance that we stored when as_view was called. if getattr(view, 'cls_instance', None): view = view.cls_instance - + # If this view has a resource that's been overridden, then use the resource's doctring if getattr(view, 'resource', None) not in (None, Resource, FormResource, ModelResource): doc = view.resource.__doc__ - + # Otherwise use the view doctring elif getattr(view, '__doc__', None): doc = view.__doc__ @@ -81,11 +81,11 @@ def get_description(view): whitespace_counts = [len(line) - len(line.lstrip(' ')) for line in doc.splitlines()[1:] if line.lstrip()] - # unindent the docstring if needed + # unindent the docstring if needed if whitespace_counts: whitespace_pattern = '^' + (' ' * min(whitespace_counts)) return re.sub(re.compile(whitespace_pattern, re.MULTILINE), '', doc) # otherwise return it as-is return doc - + -- cgit v1.2.3