dabo Commit
Revision 6969
Date: 2011-11-18 03:08:14 -0800 (Fri, 18 Nov 2011)
Author: Jacekk
Trac: http://trac.dabodev.com/changeset/6969

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

Log:
Added afterSetCurrentParent() hook method, called on every child bizobj when 
its parent sets his cursor. It allows to build additional logic since child 
cursor requery has take place only for expired data.

Diff:
Modified: trunk/dabo/biz/dBizobj.py
===================================================================
--- trunk/dabo/biz/dBizobj.py   2011-11-09 22:27:11 UTC (rev 6968)
+++ trunk/dabo/biz/dBizobj.py   2011-11-18 11:08:14 UTC (rev 6969)
@@ -1430,6 +1430,7 @@
                                if updateChildren and child.RequeryWithParent 
and child.cacheExpired() \
                                                and not child.isAnyChanged():
                                        child.requery()
+                               child.afterSetCurrentParent()
 
 
        def moveToPK(self, pk):
@@ -1467,7 +1468,7 @@
                return ret
 
 
-       def seek(self, val, fld=None, caseSensitive=False, near=False, 
runRequery=True, 
+       def seek(self, val, fld=None, caseSensitive=False, near=False, 
runRequery=True,
                        sort=True, incremental=False):
                """
                Search for a value in a field, and move the record pointer to 
the match.
@@ -1491,7 +1492,7 @@
                
                Returns the RowNumber of the found record, or -1 if no match 
found.
                """
-               ret = self._CurrentCursor.seek(val, fld, caseSensitive, near, 
+               ret = self._CurrentCursor.seek(val, fld, caseSensitive, near,
                                sort=sort, incremental=incremental)
                if ret != -1:
                        if runRequery:
@@ -1726,7 +1727,7 @@
                """
                assoc = self._associations.pop(mmBizobj.DataSource, None)
 
-                       
+
        def getAncestorByDataSource(self, ds):
                """
                Given a DataSource, finds the ancestor (parent, grandparent, 
etc.) of
@@ -2148,7 +2149,7 @@
                except dException.DBQueryException:
                        if startTransaction:
                                self.rollbackTransaction(crs)
-                       raise 
+                       raise
                self.commitTransaction(crs)
                return ret
 
@@ -2408,6 +2409,8 @@
        afterNext = _makeHookMethod("afterNext", "navigating to the next 
record")
        afterFirst = _makeHookMethod("afterFirst", "navigating to the next 
record")
        afterLast = _makeHookMethod("afterLast", "navigating to the last 
record")
+       afterSetCurrentParent = _makeHookMethod("afterSetCurrentParent",
+                       "the parent cursor changes")
        afterPointerMove = _makeHookMethod("afterPointerMove",
                        "the record pointer moves")
        afterDeleteAllChildren = _makeHookMethod("afterDeleteAllChildren",
@@ -2793,7 +2796,7 @@
                except AttributeError:
                        ret = self._requeryChildrenOnNavigate = True
                        return ret
-       
+
        def _setRequeryChildrenOnNavigate(self, val):
                self._requeryChildrenOnNavigate = bool(val)
 
@@ -3052,7 +3055,7 @@
        RequeryChildOnSave = property(_getRequeryChildOnSave, 
_setRequeryChildOnSave, None,
                        _("Do we requery child bizobjs after a save()? (bool)"))
 
-       RequeryChildrenOnNavigate = property(_getRequeryChildrenOnNavigate, 
+       RequeryChildrenOnNavigate = property(_getRequeryChildrenOnNavigate,
                        _setRequeryChildrenOnNavigate, None,
                        _("""Do we requery child bizobjs when navigating 
records? (bool)
 



_______________________________________________
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