dabo Commit
Revision 6906
Date: 2011-10-20 16:27:27 -0700 (Thu, 20 Oct 2011)
Author: Paul
Trac: http://trac.dabodev.com/changeset/6906

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

Log:
Added before/afterSaveAll() hook methods to dBizobj.


Diff:
Modified: trunk/dabo/biz/dBizobj.py
===================================================================
--- trunk/dabo/biz/dBizobj.py   2011-10-17 17:45:16 UTC (rev 6905)
+++ trunk/dabo/biz/dBizobj.py   2011-10-20 23:27:27 UTC (rev 6906)
@@ -426,6 +426,10 @@
                        # If there are no records, there can be no changes
                        return
 
+               errMsg = self.beforeSaveAll()
+               if errMsg:
+                       raise dException.BusinessRuleViolation(errMsg)
+
                startTransaction = startTransaction and self.beginTransaction()
                try:
                        self.scan(self.save, startTransaction=False, 
scanRequeryChildren=False)
@@ -439,7 +443,9 @@
                                self.rollbackTransaction()
                        raise
 
+               self.afterSaveAll()
 
+
        def save(self, startTransaction=True, saveTheChildren=True):
                """
                Save any changes that have been made in the current row.
@@ -2369,7 +2375,8 @@
                        "all child records are deleted")
        beforeSetRowNumber = _makeHookMethod("beforeSetRowNumber",
                        "the RowNumber property is set")
-       beforeSave = _makeHookMethod("beforeSave", "the changed records are 
saved.")
+       beforeSave = _makeHookMethod("beforeSave", "the current record is 
saved.")
+       beforeSaveAll = _makeHookMethod("beforeSaveAll", "all the changed 
records are saved.")
        beforeCancel = _makeHookMethod("beforeCancel",
                        "the changed records are canceled.")
        beforeRequery = _makeHookMethod("beforeRequery", "the cursor is 
requeried")
@@ -2400,7 +2407,8 @@
                        "all child records are deleted")
        afterSetRowNumber = _makeHookMethod("afterSetRowNumber",
                        "the RowNumber property is set")
-       afterSave = _makeHookMethod("afterSave", "the changed records are 
saved.")
+       afterSave = _makeHookMethod("afterSave", "the current record is saved.")
+       afterSaveAll = _makeHookMethod("afterSaveAll", "all the the changed 
records are saved.")
        afterCancel = _makeHookMethod("afterCancel",
                        "the changed records are canceled.")
        afterRequery = _makeHookMethod("afterRequery", "the cursor is 
requeried")



_______________________________________________
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