Commits

Mike Bayer committed 764ffec

- Fixed bug in composite types which prevented a primary-key
composite type from being mutated [ticket:1213].

  • Participants
  • Parent commits 68710ba
  • Branches rel_0_4

Comments (0)

Files changed (3)

       reentrant mapper compile() calls, something that occurs when
       using declarative constructs inside of ForeignKey objects.
       Ported from 0.5.
+
+    - Fixed bug in composite types which prevented a primary-key
+      composite type from being mutated [ticket:1213].
       
 0.4.8
 =====

File lib/sqlalchemy/orm/mapper.py

                                     params[col.key] = prop.get_col_value(col, added[0])
                                 if col in pks:
                                     if deleted:
-                                        params[col._label] = deleted[0]
+                                        params[col._label] = prop.get_col_value(col, deleted[0])
                                     else:
                                         # row switch logic can reach us here
-                                        params[col._label] = added[0]
+                                        params[col._label] = prop.get_col_value(col, added[0])
                                 hasdata = True
                             elif col in pks:
                                 params[col._label] = mapper._get_state_attr_by_column(state, col)

File test/orm/mapper.py

         g2 = sess.query(Graph).get(Version(1, 1))
         assert g.version == g2.version
 
+        # test pk mutation
+        g2.version = Version(2, 1)
+        sess.flush()
+        g3 = sess.query(Graph).get(Version(2, 1))
+        assert g2.version == g3.version
 
 
 class NoLoadTest(MapperSuperTest):