diff options
| author | Matt Chisholm <matt@theory.org> | 2014-07-27 12:15:36 +0200 |
|---|---|---|
| committer | Matt Chisholm <matt@theory.org> | 2014-08-09 11:03:10 +0200 |
| commit | 88f7ec6a0efe68305d5d1ee429565c1778ec6a87 (patch) | |
| tree | 53b251f8dedad6e0ee48fd5c27c81eff9e18cfaa /lib/sqlalchemy/ext/mutable.py | |
| parent | 35551841c522d8eb20f8e20243a5510de9d95dfc (diff) | |
| download | sqlalchemy-88f7ec6a0efe68305d5d1ee429565c1778ec6a87.tar.gz | |
fix MutableDict.coerce
If a class inherited from MutableDict (say, for instance, to add an update() method), coerce() would give back an instance of MutableDict instead of an instance of the derived class.
Diffstat (limited to 'lib/sqlalchemy/ext/mutable.py')
| -rw-r--r-- | lib/sqlalchemy/ext/mutable.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/sqlalchemy/ext/mutable.py b/lib/sqlalchemy/ext/mutable.py index 7469bcbda..1a4568f23 100644 --- a/lib/sqlalchemy/ext/mutable.py +++ b/lib/sqlalchemy/ext/mutable.py @@ -627,10 +627,10 @@ class MutableDict(Mutable, dict): @classmethod def coerce(cls, key, value): - """Convert plain dictionary to MutableDict.""" - if not isinstance(value, MutableDict): + """Convert plain dictionary to instance of this class.""" + if not isinstance(value, cls): if isinstance(value, dict): - return MutableDict(value) + return cls(value) return Mutable.coerce(key, value) else: return value |
