dabo Commit
Revision 4055
Date: 2008-04-27 11:48:03 -0700 (Sun, 27 Apr 2008)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/4055

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

Log:
Attempt to correct a bug that was reported by Karsten Weinert when navigating 
through cursors that have new unsaved records with associated new unsaved child 
records.

I say "attempt" because while it corrects his problem, it may affect other 
situations, such as that reported by John Fabiani in Trac Issue #1027. Before 
releasing this to all, could as many of you as possible test this with your 
parent/child bizobj setups, and let me know of any problems?


Diff:
Modified: trunk/dabo/biz/dBizobj.py
===================================================================
--- trunk/dabo/biz/dBizobj.py   2008-04-26 14:57:46 UTC (rev 4054)
+++ trunk/dabo/biz/dBizobj.py   2008-04-27 18:48:03 UTC (rev 4055)
@@ -1263,22 +1263,24 @@
                if errMsg:
                        raise dException.BusinessRuleViolation, errMsg
 
-               if self.IsAdding and self.AutoPopulatePK:
-                       pk = None
-               else:
-                       try:
-                               pk = self.getPK()
-                       except dException.NoRecordsException:
-                               # There aren't any records, all children should 
requery to 0 records.
-                               # We can't set the pk to None, because None has 
special meaning 
-                               # elsewhere (self.__currentCursorKey).
-                               pk = NO_RECORDS_PK
+               newAutopop = (self.IsAdding and self.AutoPopulatePK)
+               try:
+                       pk = self.getPK()
+               except dException.NoRecordsException:
+                       # There aren't any records, all children should requery 
to 0 records.
+                       # We can't set the pk to None, because None has special 
meaning 
+                       # elsewhere (self.__currentCursorKey).
+                       pk = NO_RECORDS_PK
 
                for child in self.__children:
                        # Let the child know the current dependent PK
                        if child.RequeryWithParent:
                                child.setCurrentParent(pk, 
fromChildRequery=True)
-                               if not child.isAnyChanged():
+                               if newAutopop and (child.RowCount == 0):
+                                       parentPK = None
+                               else:
+                                       parentPK = pk
+                               if not child.isAnyChanged(parentPK=parentPK):
                                        child.requery()
                self.afterChildRequery()
 




_______________________________________________
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