dabo Commit
Revision 6597
Date: 2011-05-25 11:34:45 -0700 (Wed, 25 May 2011)
Author: Jacekk
Trac: http://trac.dabodev.com/changeset/6597

Changed:
U   trunk/dabo/biz/dBizobj.py

Log:
Restore previous behavior after r6595 commit, where the save method raises 
NoRecordsException.

Diff:
Modified: trunk/dabo/biz/dBizobj.py
===================================================================
--- trunk/dabo/biz/dBizobj.py   2011-05-25 09:58:01 UTC (rev 6596)
+++ trunk/dabo/biz/dBizobj.py   2011-05-25 18:34:45 UTC (rev 6597)
@@ -409,12 +409,13 @@
                """
                # JKA: I can't see any sense in using 'scanChangedRows()' here, 
since
                # we must check for changes in 'save()' method too.
-               if not self.RowCount:
-                       # If there are no records, there can be no changes
-                       return
                rp = self._RemoteProxy
                if rp:
                        return rp.saveAll(startTransaction=startTransaction)
+               if not self.RowCount:
+                       # If there are no records, there can be no changes
+                       return
+
                startTransaction = startTransaction and self.beginTransaction()
                try:
                        self.scan(self.save, startTransaction=False, 
scanRequeryChildren=False)
@@ -436,15 +437,12 @@
                If the save is successful, the saveAll() of all child bizobjs 
will be
                called as well if saveTheChildren is True (the default).
                """
-               if not self.RowCount:
-                       # If there are no records, there can be no changes
-                       return
-               if not 
self.isChanged(includeNewUnchanged=self.SaveNewUnchanged):
-                       return
                rp = self._RemoteProxy
                if rp:
                        return rp.save(startTransaction=startTransaction)
-
+               rowCount = self.RowCount
+               if not 
self.isChanged(includeNewUnchanged=self.SaveNewUnchanged) and rowCount:
+                       return
                # Check if current data set is changed.
                cursor = self._CurrentCursor
                errMsg = self.beforeSave()
@@ -469,7 +467,8 @@
 
                try:
                        # Maybe this record isn't changed but some children are.
-                       if isRowChanged or isAdding:
+                       # We must call cursor.save() for empty dataset to get 
NoRecordsException.
+                       if isRowChanged or isAdding or not rowCount:
                                # Save cursor data.
                                cursor.save(includeNewUnchanged=True)
                                if isAdding:



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to