dabo Commit
Revision 5047
Date: 2009-02-08 18:24:03 -0800 (Sun, 08 Feb 2009)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5047

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

Log:
Updated the RemoteBizobj class to handle parent/child data correctly. 
Previously only parent bizobj data was being saved; now it works correctly.


Diff:
Modified: trunk/dabo/biz/RemoteBizobj.py
===================================================================
--- trunk/dabo/biz/RemoteBizobj.py      2009-02-09 02:01:51 UTC (rev 5046)
+++ trunk/dabo/biz/RemoteBizobj.py      2009-02-09 02:24:03 UTC (rev 5047)
@@ -131,7 +131,8 @@
                if myDiff:
                        self.DataSource = myDiff[0]
                        self.KeyField = kf = myDiff[1]
-                       changeRecs = myDiff[2].get(self.hashval, [])
+                       changeRecs = myDiff[2]
+                       kids = myDiff[3]
                        for rec in changeRecs:
                                newrec = rec.get(kons.CURSOR_TMPKEY_FIELD, 
False)
                                if newrec:
@@ -156,19 +157,15 @@
                                                                        
_("Update Conflict: the value in column '%s' has been changed by someone 
else.") % col)
                                        self.setFieldVal(col, newval)
 
-                       kids = diff.pop("children", None)
                        if kids:
-                               for kid in kids:
-                                       for kk, vv in kid.items:
-                                               # The key will either be the 
kid's hashval, or the string 'children'.
-                                               # Skip 'children', as the child 
bizobj will process that.
-                                               if kk == "children":
-                                                       continue
-                                               kidHash = kk
-                                               kidDS = vv[0]
-                                               kidBiz = 
RemoteBizobj.load(kidHash, kidDS)
-                                               kidBiz.applyDiffAndSave(kid)
-
+                               for kidHash, kidInfo in kids.items():
+                                       kidDS, kidKey, kidData, kidKids = 
kidInfo
+                                       kidClass = dabo._bizDict.get(kidDS)
+                                       if not kidClass:
+                                               abort(404, _("DataSource '%s' 
not found") % kidDS)
+                                       kidBiz = kidClass.load(kidHash, kidDS)
+                                       kidBiz.applyDiffAndSave({kidHash: 
kidInfo})
+                       
                        try:
                                self.saveAll()
                        except dException.ConnectionLostException, e:



_______________________________________________
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