]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- big fix to AssociationProxy so that multiple AssociationProxy
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 23 Apr 2007 19:53:34 +0000 (19:53 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 23 Apr 2007 19:53:34 +0000 (19:53 +0000)
  objects can be associated with a single association collection.

CHANGES
lib/sqlalchemy/ext/associationproxy.py

diff --git a/CHANGES b/CHANGES
index 76a7edda06500d01ee9583b73493839d7e91a03d..138277c130fa7b6dc4bf08c39760cae13217460b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
 - mysql
     - support for SSL arguments given as inline within URL query string,
       prefixed with "ssl_", courtesy terjeros@gmail.com.
-      
+- extensions
+    - big fix to AssociationProxy so that multiple AssociationProxy
+      objects can be associated with a single association collection. 
 0.3.6
 - sql:
     - bindparam() names are now repeatable!  specify two
index 907ef19dcf7d783d5e75e641ed3c4e9778d21f64..65b95ccbadbfd5dd4f46c411b2b723231804e5e1 100644 (file)
@@ -29,10 +29,11 @@ class AssociationProxy(object):
           ``__init__()`` constructor and setting the proxied
           attribute.
         """
+        
         self.targetcollection = targetcollection
         self.attr = attr
         self.creator = creator
-
+        
     def __init_deferred(self):
         prop = class_mapper(self._owner_class).props[self.targetcollection]
         self._cls = prop.mapper.class_
@@ -67,7 +68,7 @@ class AssociationProxy(object):
         self._owner_class = owner
         if obj is None:
             return self
-        storage_key = '_AssociationProxy_%s' % self.targetcollection
+        storage_key = '_AssociationProxy_%s_%s' % (self.targetcollection, self.attr)
         if self.uselist:
             try:
                 return getattr(obj, storage_key)