Fixed regression & added comments.

This commit is contained in:
Xavier Ordoquy 2014-02-14 15:44:59 +01:00
parent be129b38fa
commit ea7b76f943

View File

@ -198,11 +198,13 @@ class BaseSerializer(WritableField):
# Handle allow_add_remove depreaction # Handle allow_add_remove depreaction
if hasattr(self, 'allow_add_remove'): if hasattr(self, 'allow_add_remove'):
# If we already have allow_add_remove, it's a class argument.
# By reassigning it we'll trigger the batch_mode configuration
warnings.warn('The `allow_add_remove` keyword argument is deprecated. ' warnings.warn('The `allow_add_remove` keyword argument is deprecated. '
'Use the `batch_mode` keyword argument instead.', 'Use the `batch_mode` keyword argument instead.',
DeprecationWarning, stacklevel=2) DeprecationWarning, stacklevel=2)
self.allow_add_remove = self.allow_add_remove self.allow_add_remove = self.allow_add_remove
if 'allow_add_remove' in kwargs: if allow_add_remove:
warnings.warn('The `allow_add_remove` keyword argument is deprecated. ' warnings.warn('The `allow_add_remove` keyword argument is deprecated. '
'Use the `batch_mode` keyword argument instead.', 'Use the `batch_mode` keyword argument instead.',
DeprecationWarning, stacklevel=2) DeprecationWarning, stacklevel=2)