[gnue] r9718 - trunk/gnue-forms/src/GFObjects

[email protected]
Newsgroups gmane.comp.cms.gnue.cvs
Message-ID <[email protected]>
Author: reinhard
Date: 2007-06-14 09:11:16 -0500 (Thu, 14 Jun 2007)
New Revision: 9718

Modified:
   trunk/gnue-forms/src/GFObjects/GFBlock.py
Log:
Return a result on prev_record(), next_record() and search_record().


Modified: trunk/gnue-forms/src/GFObjects/GFBlock.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFBlock.py	2007-06-13 16:12:43 UTC (rev 9717)
+++ trunk/gnue-forms/src/GFObjects/GFBlock.py	2007-06-14 14:11:16 UTC (rev 9718)
@@ -686,13 +686,16 @@
     def prev_record(self):
         """
         Move the record pointer to the previous record in the block.
+
+        @returns: True if the record pointer was moved, False if it was already
+            the first record.
         """
 
         if self.mode == 'query':
-            return
+            return False
 
         if self.__resultset.isFirstRecord():
-            return
+            return False
 
         self._focus_out()
 
@@ -700,6 +703,8 @@
 
         self._focus_in()
 
+        return True
+
     # -------------------------------------------------------------------------
 
     def next_record(self):
@@ -708,16 +713,20 @@
 
         If the record is already the last one, a new record will be created if
         the "autoCreate" attribute of the block is set.
+
+        @returns: True if the record pointer was moved, False if it was already
+            the last record and no new record was inserted.
         """
 
         if self.mode == 'query':
-            return
+            return False
 
         if self.__resultset.isLastRecord():
             if self.autoCreate and self.get_record_status() != 'empty' and \
                     not self.editable in('update', 'N'):
                 self.new_record()
-            return
+                return True
+            return False
 
         self._focus_out()
 
@@ -725,6 +734,8 @@
 
         self._focus_in()
 
+        return True
+
     # -------------------------------------------------------------------------
 
     def last_record(self):
@@ -803,7 +814,7 @@
         """
 
         if self.mode == 'query':
-            return
+            return False
 
         # First, convert the fieldname/value pairs to column/value pairs.
         cond = {}
@@ -813,11 +824,13 @@
 
         self._focus_out()
 
-        self.__resultset.findRecord(cond)
+        result = (self.__resultset.findRecord(cond) is not None)
 
         self._focus_in()
 
+        return result
 
+
     # -------------------------------------------------------------------------
     # Status information
     # -------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.