summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/instrumentation.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-07-26 14:21:58 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-07-26 14:21:58 -0400
commit4505425a38b079a8e2a59fdbe31bc033de25e871 (patch)
treed0dd695935aee0e26f8cd9ca36bc39f6df7e66ef /lib/sqlalchemy/orm/instrumentation.py
parent550141b14c8e165218cd32c27d91541eeee86d2a (diff)
downloadsqlalchemy-4505425a38b079a8e2a59fdbe31bc033de25e871.tar.gz
- Removal of event listeners is now implemented. The feature is
provided via the :func:`.event.remove` function. [ticket:2268] - reorganization of event.py module into a package; with the addition of the docstring work as well as the new registry for removal, there's a lot more code now. the package separates concerns and provides a top-level doc for each subsection of functionality - the remove feature works by providing the EventKey object which associates the user-provided arguments to listen() with a global, weak-referencing registry. This registry stores a collection of _ListenerCollection and _DispatchDescriptor objects associated with each set of arguments, as well as the wrapped function which was applied to that collection. The EventKey can then be recreated for a removal, all the _ListenerCollection and _DispatchDescriptor objects are located, and the correct wrapped function is removed from each one.
Diffstat (limited to 'lib/sqlalchemy/orm/instrumentation.py')
-rw-r--r--lib/sqlalchemy/orm/instrumentation.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/instrumentation.py b/lib/sqlalchemy/orm/instrumentation.py
index 368a6a0b1..877a72193 100644
--- a/lib/sqlalchemy/orm/instrumentation.py
+++ b/lib/sqlalchemy/orm/instrumentation.py
@@ -81,6 +81,12 @@ class ClassManager(dict):
dispatch = event.dispatcher(events.InstanceEvents)
+ def __hash__(self):
+ return id(self)
+
+ def __eq__(self, other):
+ return other is self
+
@property
def is_mapped(self):
return 'mapper' in self.__dict__