From c903f071a82ce8784a4aa7f5e0d4264443e1944b Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 26 Jul 2013 19:11:33 -0400 Subject: - add event.contains() function to the event package, returns True if the given target/event/fn is set up to listen. - repair mutable package which is doing some conditional event listening --- lib/sqlalchemy/ext/mutable.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sqlalchemy/ext/mutable.py') diff --git a/lib/sqlalchemy/ext/mutable.py b/lib/sqlalchemy/ext/mutable.py index d3133b1f5..5458de381 100644 --- a/lib/sqlalchemy/ext/mutable.py +++ b/lib/sqlalchemy/ext/mutable.py @@ -595,7 +595,7 @@ def _setup_composite_listener(): issubclass(prop.composite_class, MutableComposite)): prop.composite_class._listen_on_attribute( getattr(class_, prop.key), False, class_) - if not Mapper.dispatch.mapper_configured._contains(Mapper, _listen_for_type): + if not event.contains(Mapper, "mapper_configured", _listen_for_type): event.listen(Mapper, 'mapper_configured', _listen_for_type) _setup_composite_listener() -- cgit v1.2.1 From 539922f00c79c0a05363972bbcf17d179cc9ecaa Mon Sep 17 00:00:00 2001 From: Vraj Mohan Date: Fri, 15 Nov 2013 08:41:00 -0500 Subject: Remove reference to defunct class We should probably reword this entirely as, IMHO, this should be in the changelog and not in the doc proper (which should only describe the current state of affairs). --- lib/sqlalchemy/ext/mutable.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sqlalchemy/ext/mutable.py') diff --git a/lib/sqlalchemy/ext/mutable.py b/lib/sqlalchemy/ext/mutable.py index 5458de381..a83a2a19f 100644 --- a/lib/sqlalchemy/ext/mutable.py +++ b/lib/sqlalchemy/ext/mutable.py @@ -9,7 +9,7 @@ which are propagated into ORM change events on owning parent objects. The :mod:`sqlalchemy.ext.mutable` extension replaces SQLAlchemy's legacy approach to in-place mutations of scalar values, established by the -:class:`.types.MutableType` class as well as the ``mutable=True`` type flag, +``types.MutableType`` class as well as the ``mutable=True`` type flag, with a system that allows change events to be propagated from the value to the owning parent, thereby removing the need for the ORM to maintain copies of values as well as the very expensive requirement of scanning through all -- cgit v1.2.1 From a62afc6229969e71c1c8f12f1e47299824eb3884 Mon Sep 17 00:00:00 2001 From: Vraj Mohan Date: Fri, 15 Nov 2013 08:32:07 -0500 Subject: Fix cross references --- lib/sqlalchemy/ext/mutable.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/sqlalchemy/ext/mutable.py') diff --git a/lib/sqlalchemy/ext/mutable.py b/lib/sqlalchemy/ext/mutable.py index a83a2a19f..37c599e1d 100644 --- a/lib/sqlalchemy/ext/mutable.py +++ b/lib/sqlalchemy/ext/mutable.py @@ -182,7 +182,7 @@ callbacks. In our case, this is a good thing, since if this dictionary were picklable, it could lead to an excessively large pickle size for our value objects that are pickled by themselves outside of the context of the parent. The developer responsibility here is only to provide a ``__getstate__`` method -that excludes the :meth:`~.MutableBase._parents` collection from the pickle +that excludes the :meth:`~MutableBase._parents` collection from the pickle stream:: class MyMutableType(Mutable): @@ -332,7 +332,7 @@ Supporting Pickling As is the case with :class:`.Mutable`, the :class:`.MutableComposite` helper class uses a ``weakref.WeakKeyDictionary`` available via the -:meth:`.MutableBase._parents` attribute which isn't picklable. If we need to +:meth:`MutableBase._parents` attribute which isn't picklable. If we need to pickle instances of ``Point`` or its owning class ``Vertex``, we at least need to define a ``__getstate__`` that doesn't include the ``_parents`` dictionary. Below we define both a ``__getstate__`` and a ``__setstate__`` that package up @@ -349,7 +349,7 @@ the minimal form of our ``Point`` class:: As with :class:`.Mutable`, the :class:`.MutableComposite` augments the pickling process of the parent's object-relational state so that the -:meth:`.MutableBase._parents` collection is restored to all ``Point`` objects. +:meth:`MutableBase._parents` collection is restored to all ``Point`` objects. """ from ..orm.attributes import flag_modified @@ -542,7 +542,7 @@ class Mutable(MutableBase): To associate a particular mutable type with all occurrences of a particular type, use the :meth:`.Mutable.associate_with` classmethod - of the particular :meth:`.Mutable` subclass to establish a global + of the particular :class:`.Mutable` subclass to establish a global association. .. warning:: -- cgit v1.2.1 From 1e7bb35fd2d58cc5928932d920e665b5c1b02174 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 29 Nov 2013 16:32:24 -0500 Subject: - reduce verbiage in mutation.py regarding legacy style, place under versionadded --- lib/sqlalchemy/ext/mutable.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'lib/sqlalchemy/ext/mutable.py') diff --git a/lib/sqlalchemy/ext/mutable.py b/lib/sqlalchemy/ext/mutable.py index 37c599e1d..1933d44ab 100644 --- a/lib/sqlalchemy/ext/mutable.py +++ b/lib/sqlalchemy/ext/mutable.py @@ -7,13 +7,9 @@ """Provide support for tracking of in-place changes to scalar values, which are propagated into ORM change events on owning parent objects. -The :mod:`sqlalchemy.ext.mutable` extension replaces SQLAlchemy's legacy -approach to in-place mutations of scalar values, established by the -``types.MutableType`` class as well as the ``mutable=True`` type flag, -with a system that allows change events to be propagated from the value to -the owning parent, thereby removing the need for the ORM to maintain copies -of values as well as the very expensive requirement of scanning through all -"mutable" values on each flush call, looking for changes. +.. versionadded:: 0.7 :mod:`sqlalchemy.ext.mutable` replaces SQLAlchemy's + legacy approach to in-place mutations of scalar values; see + :ref:`07_migration_mutation_extension`. .. _mutable_scalars: -- cgit v1.2.1 From f89d4d216bd7605c920b7b8a10ecde6bfea2238c Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 5 Jan 2014 16:57:05 -0500 Subject: - happy new year --- lib/sqlalchemy/ext/mutable.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sqlalchemy/ext/mutable.py') diff --git a/lib/sqlalchemy/ext/mutable.py b/lib/sqlalchemy/ext/mutable.py index 1933d44ab..82410031d 100644 --- a/lib/sqlalchemy/ext/mutable.py +++ b/lib/sqlalchemy/ext/mutable.py @@ -1,5 +1,5 @@ # ext/mutable.py -# Copyright (C) 2005-2013 the SQLAlchemy authors and contributors +# Copyright (C) 2005-2014 the SQLAlchemy authors and contributors # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php -- cgit v1.2.1