Commits

Mike Bayer committed 764ffec

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

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
 =====

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)

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):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.