Mike Bayer avatar Mike Bayer committed cc12b56

- [feature] The 'objects' argument to
flush() is no longer deprecated, as some
valid use cases have been identified.

Comments (0)

Files changed (4)

     to [ticket:1892] as this was supposed
     to be part of that, this is [ticket:2491].
 
+  - [feature] The 'objects' argument to 
+    flush() is no longer deprecated, as some
+    valid use cases have been identified.  
+
 - engine
   - [bug] Fixed memory leak in C version of
     result proxy whereby DBAPIs which don't deliver

lib/sqlalchemy/orm/session.py

         will create a transaction on the fly that surrounds the entire set of
         operations int the flush.
 
-        objects
-          Optional; a list or tuple collection.  Restricts the flush operation
-          to only these objects, rather than all pending changes.
-          Deprecated - this flag prevents the session from properly maintaining
-          accounting among inter-object relations and can cause invalid results.
+        :param objects: Optional; restricts the flush operation to operate 
+          only on elements that are in the given collection.
+          
+          This feature is for an extremely narrow set of use cases where
+          particular objects may need to be operated upon before the 
+          full flush() occurs.  It is not intended for general use.
 
         """
 
-        if objects:
-            util.warn_deprecated(
-                "The 'objects' argument to session.flush() is deprecated; "
-                "Please do not add objects to the session which should not "
-                "yet be persisted.")
-
         if self._flushing:
             raise sa_exc.InvalidRequestError("Session is already flushing")
 

test/orm/test_cascade.py

             Column("parent_id", Integer, ForeignKey("parent.id"))
         )
 
-    @testing.uses_deprecated()
     def test_o2m_m2o(self):
         base, noninh_child = self.tables.base, self.tables.noninh_child
 
         assert c2 in sess and c2 not in sess.new
         assert b1 in sess and b1 in sess.new
 
-    @testing.uses_deprecated()
     def test_circular_sort(self):
         """test ticket 1306"""
 

test/orm/test_session.py

                       Integer, primary_key=True,
                       test_needs_autoincrement=True)))
 
-    @testing.uses_deprecated()
     def _test_instance_guards(self, user_arg):
         watchdog = set()
 
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.