diff options
| author | Carl Meyer <carl@oddbird.net> | 2014-11-22 22:29:23 -0700 |
|---|---|---|
| committer | Carl Meyer <carl@oddbird.net> | 2014-11-22 22:29:23 -0700 |
| commit | bcb693ebd4d3743cb194c6fd05b2d70fb9696a4c (patch) | |
| tree | f32e2fd8c6152f9c5ad2b198f18f77b0fdac59c5 /django/db | |
| parent | f36151ed169813f2873e13ca9de616cfa4095321 (diff) | |
Revert "Fixed #23892 -- Made deconstructible classes forwards compatible"
This reverts commit f36151ed169813f2873e13ca9de616cfa4095321.
Adding kwargs to deconstructed objects does not achieve useful
forward-compatibility in general, since additional arguments are silently
dropped rather than having their intended effect. In fact, it can make the
failure more difficult to diagnose. Thanks Shai Berger for discussion.
Diffstat (limited to 'django/db')
| -rw-r--r-- | django/db/migrations/operations/base.py | 3 | ||||
| -rw-r--r-- | django/db/migrations/operations/fields.py | 8 | ||||
| -rw-r--r-- | django/db/migrations/operations/models.py | 16 | ||||
| -rw-r--r-- | django/db/migrations/operations/special.py | 6 |
4 files changed, 15 insertions, 18 deletions
diff --git a/django/db/migrations/operations/base.py b/django/db/migrations/operations/base.py index 167034c8f3..655f03a4c6 100644 --- a/django/db/migrations/operations/base.py +++ b/django/db/migrations/operations/base.py @@ -37,9 +37,6 @@ class Operation(object): self._constructor_args = (args, kwargs) return self - def __init__(self, **kwargs): - pass - def deconstruct(self): """ Returns a 3-tuple of class import path (or just name if it lives diff --git a/django/db/migrations/operations/fields.py b/django/db/migrations/operations/fields.py index 41cae1ea1e..ecfa5d6387 100644 --- a/django/db/migrations/operations/fields.py +++ b/django/db/migrations/operations/fields.py @@ -10,7 +10,7 @@ class AddField(Operation): Adds a field to a model. """ - def __init__(self, model_name, name, field, preserve_default=True, **kwargs): + def __init__(self, model_name, name, field, preserve_default=True): self.model_name = model_name self.name = name self.field = field @@ -69,7 +69,7 @@ class RemoveField(Operation): Removes a field from a model. """ - def __init__(self, model_name, name, **kwargs): + def __init__(self, model_name, name): self.model_name = model_name self.name = name @@ -113,7 +113,7 @@ class AlterField(Operation): Alters a field's database column (e.g. null, max_length) to the provided new field """ - def __init__(self, model_name, name, field, preserve_default=True, **kwargs): + def __init__(self, model_name, name, field, preserve_default=True): self.model_name = model_name self.name = name self.field = field @@ -177,7 +177,7 @@ class RenameField(Operation): Renames a field on the model. Might affect db_column too. """ - def __init__(self, model_name, old_name, new_name, **kwargs): + def __init__(self, model_name, old_name, new_name): self.model_name = model_name self.old_name = old_name self.new_name = new_name diff --git a/django/db/migrations/operations/models.py b/django/db/migrations/operations/models.py index 11ac1d9640..8672cf4515 100644 --- a/django/db/migrations/operations/models.py +++ b/django/db/migrations/operations/models.py @@ -14,7 +14,7 @@ class CreateModel(Operation): serialization_expand_args = ['fields', 'options'] - def __init__(self, name, fields, options=None, bases=None, **kwargs): + def __init__(self, name, fields, options=None, bases=None): self.name = name self.fields = fields self.options = options or {} @@ -79,7 +79,7 @@ class DeleteModel(Operation): Drops a model's table. """ - def __init__(self, name, **kwargs): + def __init__(self, name): self.name = name def deconstruct(self): @@ -116,7 +116,7 @@ class RenameModel(Operation): Renames a model. """ - def __init__(self, old_name, new_name, **kwargs): + def __init__(self, old_name, new_name): self.old_name = old_name self.new_name = new_name @@ -209,7 +209,7 @@ class AlterModelTable(Operation): Renames a model's table """ - def __init__(self, name, table, **kwargs): + def __init__(self, name, table): self.name = name self.table = table @@ -260,7 +260,7 @@ class AlterUniqueTogether(Operation): """ option_name = "unique_together" - def __init__(self, name, unique_together, **kwargs): + def __init__(self, name, unique_together): self.name = name unique_together = normalize_together(unique_together) self.unique_together = set(tuple(cons) for cons in unique_together) @@ -305,7 +305,7 @@ class AlterIndexTogether(Operation): """ option_name = "index_together" - def __init__(self, name, index_together, **kwargs): + def __init__(self, name, index_together): self.name = name index_together = normalize_together(index_together) self.index_together = set(tuple(cons) for cons in index_together) @@ -348,7 +348,7 @@ class AlterOrderWithRespectTo(Operation): Represents a change with the order_with_respect_to option. """ - def __init__(self, name, order_with_respect_to, **kwargs): + def __init__(self, name, order_with_respect_to): self.name = name self.order_with_respect_to = order_with_respect_to @@ -407,7 +407,7 @@ class AlterModelOptions(Operation): "verbose_name_plural", ] - def __init__(self, name, options, **kwargs): + def __init__(self, name, options): self.name = name self.options = options diff --git a/django/db/migrations/operations/special.py b/django/db/migrations/operations/special.py index 3aa7b8678e..c5181dd294 100644 --- a/django/db/migrations/operations/special.py +++ b/django/db/migrations/operations/special.py @@ -11,7 +11,7 @@ class SeparateDatabaseAndState(Operation): that affect the state or not the database, or so on. """ - def __init__(self, database_operations=None, state_operations=None, **kwargs): + def __init__(self, database_operations=None, state_operations=None): self.database_operations = database_operations or [] self.state_operations = state_operations or [] @@ -62,7 +62,7 @@ class RunSQL(Operation): by this SQL change, in case it's custom column/table creation/deletion. """ - def __init__(self, sql, reverse_sql=None, state_operations=None, **kwargs): + def __init__(self, sql, reverse_sql=None, state_operations=None): self.sql = sql self.reverse_sql = reverse_sql self.state_operations = state_operations or [] @@ -122,7 +122,7 @@ class RunPython(Operation): reduces_to_sql = False - def __init__(self, code, reverse_code=None, atomic=True, **kwargs): + def __init__(self, code, reverse_code=None, atomic=True): self.atomic = atomic # Forwards code if not callable(code): |
