summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2009-02-11 18:23:35 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2009-02-11 18:23:35 +0000
commit60dd7842f012c7aaaa534ce22be06b0db25d86df (patch)
tree8272b3635b445bcd2ddb2a7397eae3df41d546ca /lib/sqlalchemy
parenta9817ae244266a773cd6565cb61adccef7221cd2 (diff)
downloadsqlalchemy-60dd7842f012c7aaaa534ce22be06b0db25d86df.tar.gz
- Added "post_configure_attribute" method to InstrumentationManager,
so that the "listen_for_events.py" example works again. [ticket:1314]
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/attributes.py11
-rw-r--r--lib/sqlalchemy/orm/interfaces.py10
2 files changed, 18 insertions, 3 deletions
diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py
index 729ab1277..657b96190 100644
--- a/lib/sqlalchemy/orm/attributes.py
+++ b/lib/sqlalchemy/orm/attributes.py
@@ -1201,6 +1201,9 @@ class ClassManager(dict):
manager = create_manager_for_cls(cls)
manager.instrument_attribute(key, inst, True)
+ def post_configure_attribute(self, key):
+ pass
+
def uninstrument_attribute(self, key, propagated=False):
if key not in self:
return
@@ -1354,6 +1357,9 @@ class _ClassInstrumentationAdapter(ClassManager):
if not propagated:
self._adapted.instrument_attribute(self.class_, key, inst)
+ def post_configure_attribute(self, key):
+ self._adapted.post_configure_attribute(self.class_, key, self[key])
+
def install_descriptor(self, key, inst):
self._adapted.install_descriptor(self.class_, key, inst)
@@ -1579,9 +1585,10 @@ def register_attribute_impl(class_, key, **kw):
key, factory or list)
else:
typecallable = kw.pop('typecallable', None)
-
+
manager[key].impl = _create_prop(class_, key, manager, typecallable=typecallable, **kw)
-
+ manager.post_configure_attribute(key)
+
def register_descriptor(class_, key, proxy_property=None, comparator=None, parententity=None, property_=None):
manager = manager_of_class(class_)
diff --git a/lib/sqlalchemy/orm/interfaces.py b/lib/sqlalchemy/orm/interfaces.py
index 7e5427808..3b7507def 100644
--- a/lib/sqlalchemy/orm/interfaces.py
+++ b/lib/sqlalchemy/orm/interfaces.py
@@ -855,7 +855,12 @@ class LoaderStrategy(object):
return fn
class InstrumentationManager(object):
- """User-defined class instrumentation extension."""
+ """User-defined class instrumentation extension.
+
+ The API for this class should be considered as semi-stable,
+ and may change slightly with new releases.
+
+ """
# r4361 added a mandatory (cls) constructor to this interface.
# given that, perhaps class_ should be dropped from all of these
@@ -878,6 +883,9 @@ class InstrumentationManager(object):
def instrument_attribute(self, class_, key, inst):
pass
+ def post_configure_attribute(self, class_, key, inst):
+ pass
+
def install_descriptor(self, class_, key, inst):
setattr(class_, key, inst)