diff options
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/datastructures.py | 7 | ||||
| -rw-r--r-- | django/utils/deconstruct.py | 6 |
2 files changed, 3 insertions, 10 deletions
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py index 8e64328a2c..c15cb5eb49 100644 --- a/django/utils/datastructures.py +++ b/django/utils/datastructures.py @@ -235,12 +235,7 @@ class ImmutableList(tuple): AttributeError: You cannot mutate this. """ - def __new__(cls, *args, **kwargs): - if 'warning' in kwargs: - warning = kwargs['warning'] - del kwargs['warning'] - else: - warning = 'ImmutableList object is immutable.' + def __new__(cls, *args, warning='ImmutableList object is immutable.', **kwargs): self = tuple.__new__(cls, *args, **kwargs) self.warning = warning return self diff --git a/django/utils/deconstruct.py b/django/utils/deconstruct.py index 6bc70f7e53..c546fc1dea 100644 --- a/django/utils/deconstruct.py +++ b/django/utils/deconstruct.py @@ -3,15 +3,13 @@ from importlib import import_module from django.utils.version import get_docs_version -def deconstructible(*args, **kwargs): +def deconstructible(*args, path=None): """ Class decorator that allow the decorated class to be serialized by the migrations subsystem. Accepts an optional kwarg `path` to specify the import path. """ - path = kwargs.pop('path', None) - def decorator(klass): def __new__(cls, *args, **kwargs): # We capture the arguments to make returning them trivial @@ -54,4 +52,4 @@ def deconstructible(*args, **kwargs): if not args: return decorator - return decorator(*args, **kwargs) + return decorator(*args) |
