[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r6767 - in trunk: gnue-common/src/datasources gnue-common/src/datasource
From: |
johannes |
Subject: |
r6767 - in trunk: gnue-common/src/datasources gnue-common/src/datasources/drivers/appserver/appserver gnue-forms/src/GFObjects |
Date: |
Wed, 1 Dec 2004 01:59:11 -0600 (CST) |
Author: johannes
Date: 2004-12-01 01:59:09 -0600 (Wed, 01 Dec 2004)
New Revision: 6767
Modified:
trunk/gnue-common/src/datasources/GDataSource.py
trunk/gnue-common/src/datasources/drivers/appserver/appserver/RecordSet.py
trunk/gnue-forms/src/GFObjects/GFBlock.py
Log:
Added an 'update' function to GFBlock which updates the current record set of
the datasource (an thus updating all calculated fields)
Modified: trunk/gnue-common/src/datasources/GDataSource.py
===================================================================
--- trunk/gnue-common/src/datasources/GDataSource.py 2004-12-01 04:38:18 UTC
(rev 6766)
+++ trunk/gnue-common/src/datasources/GDataSource.py 2004-12-01 07:59:09 UTC
(rev 6767)
@@ -85,6 +85,8 @@
'getCondition':{'function':self.getCondition},
'setCondition':{'function':self.setCondition},
'count' : {'function':self.triggerGetCount},
+ 'update': {'function':
+ self.updateCurrentRecordSet}
}
self._triggerProperties = {'extensions':{'get':self.getExtensions,
@@ -186,6 +188,29 @@
tmsg = u_("Backend doesn't support the trigger 'call' function")
raise StandardError, tmsg
+
+ # ---------------------------------------------------------------------------
+ # Update the current record set
+ # ---------------------------------------------------------------------------
+
+ def updateCurrentRecordSet (self):
+ """
+ If a result set is available having a record all fields of this record
+ would be updated. If the backend does not support this operation an
+ ApplicationError will be raised.
+ """
+
+ if self._currentResultSet is not None:
+ nr = self._currentResultSet.getRecordNumber ()
+ rs = self._currentResultSet.getRecord (nr)
+
+ if hasattr (rs, 'updateRecordSet'):
+ rs.updateRecordSet ()
+
+ else:
+ raise errors.ApplicationError, \
+ u_("Backend does not support the 'update' function")
+
#
# get/set the static condition assosiated with a datasource
# the static condition is build out of the <condition> child
Modified:
trunk/gnue-common/src/datasources/drivers/appserver/appserver/RecordSet.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/appserver/appserver/RecordSet.py
2004-12-01 04:38:18 UTC (rev 6766)
+++ trunk/gnue-common/src/datasources/drivers/appserver/appserver/RecordSet.py
2004-12-01 07:59:09 UTC (rev 6767)
@@ -129,6 +129,7 @@
[self._fields ['gnue_id']],
methodname,
parameters) [0]
+
self.__updateFields ()
self._updateFlag = True
@@ -145,6 +146,52 @@
# ---------------------------------------------------------------------------
+ # Update the current record set
+ # ---------------------------------------------------------------------------
+
+ def updateRecordSet (self):
+ """
+ This function searches for the top level master record and post's it to the
+ backend. Doing this it makes sure all calculated fields have an up to date
+ value. As a side effect this will fire all 'OnChange' triggers bound to the
+ record's class definition.
+ """
+
+ if self._fields.get ('gnue_id') is None:
+ return
+
+ # Before calling the function, post all pending changes to the server
+ empty = self._emptyFlag
+ insert = self._insertFlag
+ update = self._updateFlag
+
+ # Find out the top level record set regarding to master-/detail and call
+ # this recordset's post (). This will do implicit post's on the details
+ current = self._parent
+
+ while current._masterRecordSet is not None:
+ current = current._masterRecordSet._parent
+
+ try:
+ current.post ()
+
+ self.__updateFields ()
+
+ # Should we check if the _fields really have changed during the post to
+ # set the flags ?
+ self._updateFlag = True
+ self._emptyFlag = False
+
+ except:
+ self._emptyFlag = empty
+ self._insertFlag = insert
+ self._updateFlag = update
+
+ raise
+
+
+
+ # ---------------------------------------------------------------------------
# Initialize a record
# ---------------------------------------------------------------------------
Modified: trunk/gnue-forms/src/GFObjects/GFBlock.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFBlock.py 2004-12-01 04:38:18 UTC (rev
6766)
+++ trunk/gnue-forms/src/GFObjects/GFBlock.py 2004-12-01 07:59:09 UTC (rev
6767)
@@ -143,7 +143,8 @@
'executeQuery':{'function':self.processQuery,
'description':'Executes the current query.'},
'call': {'function' : self.callFunction,
- 'description': 'Executes a function of the datasource'}
+ 'description': 'Executes a function of the datasource'},
+ 'update': {'function': self.updateCurrentRecordSet}
}
self._triggerProperties={
@@ -719,6 +720,18 @@
return res
+ # ---------------------------------------------------------------------------
+ # Update the current datasource's record set
+ # ---------------------------------------------------------------------------
+
+ def updateCurrentRecordSet (self):
+ try:
+ self._dataSourceLink.updateCurrentRecordSet ()
+
+ finally:
+ self.switchRecord (0)
+
+
###################################################################
#
# Trigger settable stuff
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r6767 - in trunk: gnue-common/src/datasources gnue-common/src/datasources/drivers/appserver/appserver gnue-forms/src/GFObjects,
johannes <=