diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-08-14 17:02:56 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-08-14 17:02:56 +0000 |
| commit | da9c1405d6f62a953e6274db75cfdf30ae6eb379 (patch) | |
| tree | 06897a8a78b1e3851cfb8d65f4613d6a2afa7f7e | |
| parent | bc8217cd76c73d5cbc8cd21a5e45c9e38037e5a4 (diff) | |
| download | sqlalchemy-da9c1405d6f62a953e6274db75cfdf30ae6eb379.tar.gz | |
dont see the need to re-call post_configure inside a reentrant loop. since we're
in 0.6 let's just simplify.
| -rw-r--r-- | lib/sqlalchemy/orm/mapper.py | 4 | ||||
| -rw-r--r-- | test/orm/test_mapper.py | 17 |
2 files changed, 12 insertions, 9 deletions
diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py index dcf33d07e..f4cc72cef 100644 --- a/lib/sqlalchemy/orm/mapper.py +++ b/lib/sqlalchemy/orm/mapper.py @@ -636,10 +636,6 @@ class Mapper(object): try: global _already_compiling if _already_compiling: - # re-entrance to compile() occurs rarely, when a class-mapped construct is - # used within a ForeignKey, something that is possible - # when using the declarative layer - self._post_configure_properties() return _already_compiling = True try: diff --git a/test/orm/test_mapper.py b/test/orm/test_mapper.py index 597b0bd56..01ee23231 100644 --- a/test/orm/test_mapper.py +++ b/test/orm/test_mapper.py @@ -893,11 +893,6 @@ class MapperTest(_fixtures.FixtureTest): @testing.resolve_artifact_names def test_reentrant_compile(self): - # this trips the _already_compiling - # flag in mapper.compile(). but if the m2.compile is - # changed to m1.compile, you still get a stack overflow. - # not sure why the previous use case did it that way (i.e. - # it was declarative compiling a mapper within ForeignKey()). class MyFakeProperty(sa.orm.properties.ColumnProperty): def post_instrument_class(self, mapper): super(MyFakeProperty, self).post_instrument_class(mapper) @@ -908,6 +903,18 @@ class MapperTest(_fixtures.FixtureTest): }) m2 = mapper(Address, addresses) compile_mappers() + + sa.orm.clear_mappers() + class MyFakeProperty(sa.orm.properties.ColumnProperty): + def post_instrument_class(self, mapper): + super(MyFakeProperty, self).post_instrument_class(mapper) + m1.compile() + + m1 = mapper(User, users, properties={ + 'name':MyFakeProperty(users.c.name) + }) + m2 = mapper(Address, addresses) + compile_mappers() @testing.resolve_artifact_names def test_reconstructor(self): |
