diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-04-28 12:10:24 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-04-28 12:10:24 -0400 |
commit | 425b7388cc7808751bd73a647c05fc669ea6dbbf (patch) | |
tree | c8598bb5845d01d904cecd8c74a69d0a965506ce /lib/sqlalchemy/ext/mutable.py | |
parent | d03226426c24eef5c9e19822ff07a5f72dd5379f (diff) | |
download | sqlalchemy-425b7388cc7808751bd73a647c05fc669ea6dbbf.tar.gz |
- Removed the usage of the "collections.MutableMapping"
abc from the ext.mutable docs as it was being used
incorrectly and makes the example more difficult
to understand in any case. [ticket:2152]
Diffstat (limited to 'lib/sqlalchemy/ext/mutable.py')
-rw-r--r-- | lib/sqlalchemy/ext/mutable.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/sqlalchemy/ext/mutable.py b/lib/sqlalchemy/ext/mutable.py index 9be559d04..d14cfe3c0 100644 --- a/lib/sqlalchemy/ext/mutable.py +++ b/lib/sqlalchemy/ext/mutable.py @@ -56,7 +56,7 @@ the :class:`.Mutable` mixin:: import collections from sqlalchemy.ext.mutable import Mutable - class MutationDict(Mutable, collections.MutableMapping, dict): + class MutationDict(Mutable, dict): @classmethod def coerce(cls, key, value): "Convert plain dictionaries to MutationDict." @@ -83,11 +83,11 @@ the :class:`.Mutable` mixin:: self.changed() The above dictionary class takes the approach of subclassing the Python -built-ins ``collections.MutableMapping`` and ``dict`` to produce a dict +built-in ``dict`` to produce a dict subclass which routes all mutation events through ``__setitem__``. There are many variants on this approach, such as subclassing ``UserDict.UserDict``, -etc. The part that's important to this example is that the -:meth:`.Mutable.changed` method is called whenever an in-place change to the +the newer ``collections.MutableMapping``, etc. The part that's important to this +example is that the :meth:`.Mutable.changed` method is called whenever an in-place change to the datastructure takes place. We also redefine the :meth:`.Mutable.coerce` method which will be used to @@ -193,7 +193,7 @@ stream:: With our dictionary example, we need to return the contents of the dict itself (and also restore them on __setstate__):: - class MutationDict(Mutable, collections.MutableMapping, dict): + class MutationDict(Mutable, dict): # .... def __getstate__(self): |