diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-04-26 18:22:41 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-04-26 18:22:41 -0400 |
| commit | 6c0f30db81d127920ca7a68d7a28b8ea086866b6 (patch) | |
| tree | 25b3149fbe4a419d6af3f5767c87dc19320456f3 /lib/sqlalchemy/ext/declarative/base.py | |
| parent | d48acff23bc04dafa958e76ef2ff614aa8d6751b (diff) | |
| download | sqlalchemy-6c0f30db81d127920ca7a68d7a28b8ea086866b6.tar.gz | |
- Fixed a regression regarding the :meth:`.MapperEvents.instrument_class`
event where its invocation was moved to be after the class manager's
instrumentation of the class, which is the opposite of what the
documentation for the event explicitly states. The rationale for the
switch was due to Declarative taking the step of setting up
the full "instrumentation manager" for a class before it was mapped
for the purpose of the new ``@declared_attr`` features
described in :ref:`feature_3150`, but the change was also made
against the classical use of :func:`.mapper` for consistency.
However, SQLSoup relies upon the instrumentation event happening
before any instrumentation under classical mapping.
The behavior is reverted in the case of classical and declarative
mapping, the latter implemented by using a simple memoization
without using class manager.
fixes #3388
Diffstat (limited to 'lib/sqlalchemy/ext/declarative/base.py')
| -rw-r--r-- | lib/sqlalchemy/ext/declarative/base.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/sqlalchemy/ext/declarative/base.py b/lib/sqlalchemy/ext/declarative/base.py index 062936ea7..57eb54f63 100644 --- a/lib/sqlalchemy/ext/declarative/base.py +++ b/lib/sqlalchemy/ext/declarative/base.py @@ -115,10 +115,10 @@ class _MapperConfig(object): self.column_copies = {} self._setup_declared_events() - # register up front, so that @declared_attr can memoize - # function evaluations in .info - manager = instrumentation.register_class(self.cls) - manager.info['declared_attr_reg'] = {} + # temporary registry. While early 1.0 versions + # set up the ClassManager here, by API contract + # we can't do that until there's a mapper. + self.cls._sa_declared_attr_reg = {} self._scan_attributes() @@ -529,7 +529,7 @@ class _MapperConfig(object): self.local_table, **self.mapper_args ) - del mp_.class_manager.info['declared_attr_reg'] + del self.cls._sa_declared_attr_reg return mp_ |
