- 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]
This commit is contained in:
Mike Bayer
2011-04-28 12:10:24 -04:00
parent d03226426c
commit 425b7388cc
2 changed files with 11 additions and 5 deletions
+6
View File
@@ -61,6 +61,12 @@ CHANGES
- Fixed the psycopg2_version parsing in the
psycopg2 dialect.
- documentation
- 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]
- examples
- removed the ancient "polymorphic association"
examples and replaced with an updated set of
+5 -5
View File
@@ -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):