]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Fixed a regression in 0.6.5 which occurred if you
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 15 Sep 2010 23:17:14 +0000 (19:17 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 15 Sep 2010 23:17:14 +0000 (19:17 -0400)
passed an empty list to "include_properties" on
mapper() [ticket:1918]

CHANGES
lib/sqlalchemy/orm/mapper.py
test/orm/test_mapper.py

diff --git a/CHANGES b/CHANGES
index 657695c7e4e1b2717494c051abce3fc959ea182d..519f454301bb8cc0414ff2e7acd857856dd5e020 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -11,6 +11,10 @@ CHANGES
     backrefs involved, where the initiating parent
     was a subclass (with its own mapper) of the 
     previous parent.
+
+  - Fixed a regression in 0.6.5 which occurred if you 
+    passed an empty list to "include_properties" on 
+    mapper() [ticket:1918]
     
   - Added an assertion during flush which ensures
     that no NULL-holding identity keys were generated
index 816bf95bf56332aa35a0508b7d18654f3759b121..8d31dd89ad243539cfe34afb7b842df7d657a16e 100644 (file)
@@ -193,7 +193,7 @@ class Mapper(object):
         else:
             self.polymorphic_map = _polymorphic_map
 
-        if include_properties:
+        if include_properties is not None:
             self.include_properties = util.to_set(include_properties)
         else:
             self.include_properties = None
index 3012f4b43f9cb78dfa8ed8fe6bb2f2a038d17cd3..a19af5f4f4d4b1bb63342bf2e98a06b46e3ce615 100644 (file)
@@ -487,7 +487,10 @@ class MapperTest(_fixtures.FixtureTest):
         class HasDef(object):
             def name(self):
                 pass
-            
+        class Empty(object):pass
+        
+        empty = mapper(Empty, t, properties={'empty_id' : t.c.id}, 
+                       include_properties=[])
         p_m = mapper(Person, t, polymorphic_on=t.c.type,
                      include_properties=('id', 'type', 'name'))
         e_m = mapper(Employee, inherits=p_m,
@@ -546,6 +549,7 @@ class MapperTest(_fixtures.FixtureTest):
         # excluding the discriminator column is currently not allowed
         class Foo(Person):
             pass
+        assert_props(Empty, ['empty_id'])
 
         assert_raises(
             sa.exc.InvalidRequestError,