dabo Commit
Revision 6590
Date: 2011-05-24 09:38:10 -0700 (Tue, 24 May 2011)
Author: Paul
Trac: http://trac.dabodev.com/changeset/6590
Changed:
U trunk/dabo/biz/dBizobj.py
Log:
Added argument to biz.save() to optionally prevent child bizobjs from getting
saved. I have a situation where I want to save or possibly cancel any changed
child records in a separate function after the parent record has been saved.
Diff:
Modified: trunk/dabo/biz/dBizobj.py
===================================================================
--- trunk/dabo/biz/dBizobj.py 2011-05-12 16:21:17 UTC (rev 6589)
+++ trunk/dabo/biz/dBizobj.py 2011-05-24 16:38:10 UTC (rev 6590)
@@ -441,12 +441,12 @@
dabo.log.error(_("Failed to set RowNumber.
Error: %s") % ustr(e))
- def save(self, startTransaction=True):
+ def save(self, startTransaction=True, saveTheChildren=True):
"""
Save any changes that have been made in the current row.
If the save is successful, the saveAll() of all child bizobjs
will be
- called as well.
+ called as well if saveTheChildren is True (the default).
"""
rp = self._RemoteProxy
if rp:
@@ -474,12 +474,13 @@
# Call the hook method for saving new records.
self._onSaveNew()
- # Iterate through the child bizobjs, telling them to
save themselves.
- for child in self.__children:
- # No need to start another transaction. And
since this is a child bizobj,
- # we need to save all rows that have changed.
- if child.RowCount > 0:
- child.saveAll(startTransaction=False)
+ if saveTheChildren:
+ # Iterate through the child bizobjs, telling
them to save themselves.
+ for child in self.__children:
+ # No need to start another transaction.
And since this is a child bizobj,
+ # we need to save all rows that have
changed.
+ if child.RowCount > 0:
+
child.saveAll(startTransaction=False)
# Finish the transaction, and requery the children if
needed.
if startTransaction:
_______________________________________________
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]