mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-10-31 07:57:55 +03:00 
			
		
		
		
	Removed is_error in Response
This commit is contained in:
		
							parent
							
								
									d38f7f3ef7
								
							
						
					
					
						commit
						e227c38b33
					
				|  | @ -65,7 +65,7 @@ class DocumentingTemplateEmitter(BaseEmitter): | ||||||
|          |          | ||||||
|         # Otherwise if this isn't an error response |         # Otherwise if this isn't an error response | ||||||
|         # then attempt to get a form bound to the response object |         # then attempt to get a form bound to the response object | ||||||
|         if not form_instance and not resource.response.is_error and resource.response.has_content_body: |         if not form_instance and resource.response.has_content_body: | ||||||
|             try: |             try: | ||||||
|                 form_instance = resource.get_form(resource.response.raw_content) |                 form_instance = resource.get_form(resource.response.raw_content) | ||||||
|             except: |             except: | ||||||
|  |  | ||||||
|  | @ -12,11 +12,10 @@ from itertools import chain | ||||||
| # TODO: Display user login in top panel: http://stackoverflow.com/questions/806835/django-redirect-to-previous-page-after-login | # TODO: Display user login in top panel: http://stackoverflow.com/questions/806835/django-redirect-to-previous-page-after-login | ||||||
| # TODO: Figure how out references and named urls need to work nicely | # TODO: Figure how out references and named urls need to work nicely | ||||||
| # TODO: POST on existing 404 URL, PUT on existing 404 URL | # TODO: POST on existing 404 URL, PUT on existing 404 URL | ||||||
| # TODO: Remove is_error throughout |  | ||||||
| # | # | ||||||
|  | # NEXT: Validators to become generic, forms to move out of Resource into FormValidator | ||||||
|  | # NEXT: Permissions to become generic, UserAllowed, Throttling | ||||||
| # NEXT: Exceptions on func() -> 500, tracebacks emitted if settings.DEBUG | # NEXT: Exceptions on func() -> 500, tracebacks emitted if settings.DEBUG | ||||||
| # NEXT: Generic content form |  | ||||||
| # NEXT: Remove self.blah munging  (Add a ResponseContext object?) |  | ||||||
| # NEXT: Caching cleverness | # NEXT: Caching cleverness | ||||||
| # NEXT: Test non-existent fields on ModelResources | # NEXT: Test non-existent fields on ModelResources | ||||||
| # | # | ||||||
|  |  | ||||||
|  | @ -106,13 +106,12 @@ class NoContent(object): | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class Response(object): | class Response(object): | ||||||
|     def __init__(self, status, content=NoContent, headers={}, is_error=False): |     def __init__(self, status, content=NoContent, headers={}): | ||||||
|         self.status = status |         self.status = status | ||||||
|         self.has_content_body = not content is NoContent |         self.has_content_body = not content is NoContent | ||||||
|         self.raw_content = content      # content prior to filtering |         self.raw_content = content      # content prior to filtering | ||||||
|         self.cleaned_content = content  # content after filtering |         self.cleaned_content = content  # content after filtering | ||||||
|         self.headers = headers |         self.headers = headers | ||||||
|         self.is_error = is_error |  | ||||||
|   |   | ||||||
|     @property |     @property | ||||||
|     def status_text(self): |     def status_text(self): | ||||||
|  | @ -123,4 +122,4 @@ class Response(object): | ||||||
| 
 | 
 | ||||||
| class ResponseException(BaseException): | class ResponseException(BaseException): | ||||||
|     def __init__(self, status, content=NoContent, headers={}): |     def __init__(self, status, content=NoContent, headers={}): | ||||||
|         self.response = Response(status, content=content, headers=headers, is_error=True) |         self.response = Response(status, content=content, headers=headers) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user