commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r8033 - trunk/gnue-common/src/datasources/drivers/Base


From: reinhard
Subject: [gnue] r8033 - trunk/gnue-common/src/datasources/drivers/Base
Date: Mon, 3 Oct 2005 09:15:25 -0500 (CDT)

Author: reinhard
Date: 2005-10-03 09:15:24 -0500 (Mon, 03 Oct 2005)
New Revision: 8033

Modified:
   trunk/gnue-common/src/datasources/drivers/Base/RecordSet.py
Log:
Fixed requery in multi layer master/detail relationships.


Modified: trunk/gnue-common/src/datasources/drivers/Base/RecordSet.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/Base/RecordSet.py 2005-09-30 
12:58:01 UTC (rev 8032)
+++ trunk/gnue-common/src/datasources/drivers/Base/RecordSet.py 2005-10-03 
14:15:24 UTC (rev 8033)
@@ -493,56 +493,8 @@
         return True
     return False
 
-  # ---------------------------------------------------------------------------
 
-  def _needsRequery (self, commit):
-    """
-    Return True if this record should be requeried.
-
-    Records are requeried after a post and after a commit.
-
-    @param commit: indicate whether the transaction in which the last post
-      happened has been committed.
-    """
-    return (self.__requeryStatus == 'posted') \
-        or (self.__requeryStatus == 'commit' and commit) \
-        or self.isEmpty () or self.isVoid ()
-
-
   # ---------------------------------------------------------------------------
-  # Set clean data from a dictionary
-  # ---------------------------------------------------------------------------
-
-  def _initialDataFromDict (self, data):
-    """
-    Set the clean data of the record from a dictionary.
-
-    This is used when this record is in a detail ResultSet that has been
-    requeried completely.
-
-    @param data: Fieldname/value dictionary with the new clean data.
-    """
-
-    self.__initialData.update (data)
-
-    if self.__requeryStatus == 'posted':
-      # record has been written to the backend - everything is clean now
-      self.__fields.update (data)
-      self.__inserted = False
-      self.__modified = False
-      self.__modifiedFlags = {}
-      self.__requeryStatus = None
-
-    else:
-      # record may have unsaved changes because the last _post to this record
-      # (or a preceding record) failed - we have to be cautious not to
-      # overwrite changes the user has done
-      for (fieldname, value) in data.items ():
-        if not self.__modifiedFlags.has_key (fieldname):
-          self.__fields [fieldname] = value
-
-
-  # ---------------------------------------------------------------------------
   # Make this RecordSet the current one (notify all details)
   # ---------------------------------------------------------------------------
 
@@ -652,6 +604,24 @@
 
 
   # ---------------------------------------------------------------------------
+  # Return whether this record must be requeried or not
+  # ---------------------------------------------------------------------------
+
+  def _needsRequery (self, commit):
+    """
+    Return True if this record should be requeried.
+
+    Records are requeried after a post and after a commit.
+
+    @param commit: indicate whether the transaction in which the last post
+      happened has been committed.
+    """
+    return (self.__requeryStatus == 'posted') \
+        or (self.__requeryStatus == 'commit' and commit) \
+        or self.isEmpty () or self.isVoid ()
+
+
+  # ---------------------------------------------------------------------------
   # Requery the record data from the backend
   # ---------------------------------------------------------------------------
 
@@ -691,6 +661,43 @@
 
 
   # ---------------------------------------------------------------------------
+  # Set clean data from a dictionary
+  # ---------------------------------------------------------------------------
+
+  def _initialDataFromDict (self, data):
+    """
+    Set the clean data of the record from a dictionary.
+
+    This is used when this record is in a detail ResultSet that has been
+    requeried completely.
+
+    @param data: Fieldname/value dictionary with the new clean data.
+    """
+
+    self.__initialData.update (data)
+
+    if self.__requeryStatus == 'posted':
+      # record has been written to the backend - everything is clean now
+      self.__fields.update (data)
+      self.__inserted = False
+      self.__modified = False
+      self.__modifiedFlags = {}
+      self.__requeryStatus = None
+
+    else:
+      # record may have unsaved changes because the last _post to this record
+      # (or a preceding record) failed - we have to be cautious not to
+      # overwrite changes the user has done
+      for (fieldname, value) in data.items ():
+        if not self.__modifiedFlags.has_key (fieldname):
+          self.__fields [fieldname] = value
+
+    # Now, requery detail resultsets
+    for (dataSource, resultSet) in self.__cachedDetailResultSets.items ():
+      dataSource._requeryResultSet (self, resultSet)
+
+
+  # ---------------------------------------------------------------------------
   # Requery this record
   # ---------------------------------------------------------------------------
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]