mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-10-31 07:57:55 +03:00 
			
		
		
		
	Fixed comments
This commit is contained in:
		
							parent
							
								
									044fefa420
								
							
						
					
					
						commit
						e26fe4356b
					
				|  | @ -22,7 +22,8 @@ env: | |||
|     - TOX_ENV=py2.6-django1.4 | ||||
| 
 | ||||
| install: | ||||
|   - "pip install tox --download-cache $HOME/.pip-cache" | ||||
| # Virtualenv < 14 is required to keep the Python 3.2 builds running. | ||||
|   - "pip install tox 'virtualenv<14' --download-cache $HOME/.pip-cache" | ||||
| 
 | ||||
| script: | ||||
|     - tox -e $TOX_ENV | ||||
|  |  | |||
|  | @ -73,6 +73,12 @@ except ImportError: | |||
|     from collections import UserDict | ||||
|     from collections import MutableMapping as DictMixin | ||||
| 
 | ||||
| # http responses move in Python 3 | ||||
| try: | ||||
|     from httplib import responses | ||||
| except ImportError: | ||||
|     from http.client import responses | ||||
| 
 | ||||
| # Try to import PIL in either of the two ways it can end up installed. | ||||
| try: | ||||
|     from PIL import Image | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ from __future__ import unicode_literals | |||
| import django | ||||
| from django.template.response import SimpleTemplateResponse | ||||
| from django.utils import six | ||||
| import httplib | ||||
| from rest_framework.compat import responses | ||||
| 
 | ||||
| class Response(SimpleTemplateResponse): | ||||
|     """ | ||||
|  | @ -80,7 +80,7 @@ class Response(SimpleTemplateResponse): | |||
|         """ | ||||
|         # TODO: Deprecate and use a template tag instead | ||||
|         # TODO: Status code text for RFC 6585 status codes | ||||
|         return httplib[self.status_code] | ||||
|         return responses.get(self.status_code, '') | ||||
| 
 | ||||
|     def __getstate__(self): | ||||
|         """ | ||||
|  |  | |||
|  | @ -1079,12 +1079,12 @@ class ModelSerializer(Serializer): | |||
|                     fk_field = obj._meta.get_field_by_name(accessor_name)[0].field.name | ||||
|                     setattr(related, fk_field, obj) | ||||
|                     self.save_object(related) | ||||
|                 elif isinstance(related, list): | ||||
|                     # Many to One/Many | ||||
|                     getattr(obj, accessor_name).add(*related, bulk=False) | ||||
|                 else: | ||||
|                     # Reverse FK or reverse one-one | ||||
|                     try: | ||||
|                     setattr(obj, accessor_name, related) | ||||
|                     except ValueError: | ||||
|                         getattr(obj, accessor_name).add(*related, bulk=False) | ||||
|             del(obj._related_data) | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user