]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- removed deprecated method of specifying custom collections on classes;
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 21 Feb 2007 21:55:45 +0000 (21:55 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 21 Feb 2007 21:55:45 +0000 (21:55 +0000)
you must now use the "collection_class" option. the old way was
beginning to produce conflicts when people used assign_mapper(), which
now patches an "options" method, in conjunction with a relationship
named "options". (relationships take precedence over monkeypatched
assign_mapper methods).

CHANGES
lib/sqlalchemy/orm/attributes.py
test/orm/unitofwork.py

diff --git a/CHANGES b/CHANGES
index b2bec558cb52ee592f18bca2add3df78908b2ce0..df9d376125ad0ea09dc43a25c085d327c59f8f5f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
       ORM behavior with relationships from/to/between mappers, particularly
       polymorphic mappers, also their usage with Query, SelectResults. tickets
       include [ticket:439], [ticket:441], [ticket:448].
+    - removed deprecated method of specifying custom collections on classes;
+      you must now use the "collection_class" option. the old way was
+      beginning to produce conflicts when people used assign_mapper(), which
+      now patches an "options" method, in conjunction with a relationship
+      named "options". (relationships take precedence over monkeypatched
+      assign_mapper methods).
     - extension() query option propigates to Mapper._instance() method so that
       all loading-related methods get called [ticket:454]
     - eager relation to an inheriting mapper wont fail if no rows returned for
index 398cdde6c5ba1bdced0e2e531ec5fb50eca2f5bd..6b2a1ee1a5c4fd40ad0cdd41c980a8ddf7924dec 100644 (file)
@@ -766,8 +766,6 @@ class AttributeManager(object):
             class_._state = property(_get_state)
         
         typecallable = kwargs.pop('typecallable', None)
-        if typecallable is None:
-            typecallable = getattr(class_, key, None)
         if isinstance(typecallable, InstrumentedAttribute):
             typecallable = None
         setattr(class_, key, self.create_prop(class_, key, uselist, callable_, typecallable=typecallable, **kwargs))
index f69519c139d3a298eda5448f6b1c5e2a639317ff..28b0e9da02664bb9c45a21a4d326a7edb8cc6096 100644 (file)
@@ -55,7 +55,7 @@ class HistoryTest(UnitOfWorkTest):
         u = s.query(m).select()[0]
         print u.addresses[0].user
 
-class CustomAttrTest(UnitOfWorkTest):
+class CustomCollectionsTest(UnitOfWorkTest):
     def setUpAll(self):
         UnitOfWorkTest.setUpAll(self)
         global sometable, metadata, someothertable
@@ -71,11 +71,11 @@ class CustomAttrTest(UnitOfWorkTest):
         class MyList(list):
             pass
         class Foo(object):
-            bars = MyList
+            pass
         class Bar(object):
             pass
         mapper(Foo, sometable, properties={
-            'bars':relation(Bar)
+            'bars':relation(Bar, collection_class=MyList)
         })
         mapper(Bar, someothertable)
         f = Foo()