Author: jamest
Date: 2005-07-26 13:48:39 -0500 (Tue, 26 Jul 2005)
New Revision: 7751

Modified:
   trunk/gnue-forms/src/GFForm.py
Log:
trigger commit() function pops up db error properly now
changed __getConnections to get a list of all connections used in form, 
not just those used by blocks.  connections not referenced by blocks
were not getting commited prior to this


Modified: trunk/gnue-forms/src/GFForm.py
===================================================================
--- trunk/gnue-forms/src/GFForm.py      2005-07-24 18:38:31 UTC (rev 7750)
+++ trunk/gnue-forms/src/GFForm.py      2005-07-26 18:48:39 UTC (rev 7751)
@@ -139,7 +139,7 @@
                               'messageBox': {'function':self.triggerMessageBox,
                                              'global': True
                                              },
-                              'commit':{'function':self.commit,
+                              'commit':{'function':self.triggerCommit,
                                         'global': True,
                                         },
                               'rollback':{'function':self.rollback,
@@ -281,7 +281,7 @@
     @param: object (page, block or entry) to find next focus for.
     @return: None or entry with next focus
     """
-
+    
     if object._type == 'GFField':
       gDebug (5, "GFField was passed to 'findFocus'.")
       try:
@@ -689,7 +689,7 @@
           # Make sure the block is in consistent state again; this has to be
           # done in any case if the processCommit was successful, even if the
           # connection commit failed - thus the "finally" here.
-          for block in self._logic._blockList:
+          for block in self._logic._blockList:            
             block.finalizeCommit ()
 
         # Execute Post-Commit-Trigger for each block
@@ -709,7 +709,7 @@
       except DBError:
         message = u_("Database commit error:\n%(exType)s\n%(exMessage)s") \
             % {'exType'   : sys.exc_info ()[0],
-               'exMessage': sys.exc_info ()[1]}
+               'exMessage': sys.exc_info ()[1]}               
 
     finally:
       # Make sure the current block still has the focus, even if an exception
@@ -753,21 +753,22 @@
 
   def __getConnections (self):
     """
-    This function creates a dictionary of all connections used by the form's
-    blocks, where the connection-name is the key and the connection instance is
+    This function creates a dictionary of all connections referenced by the 
form,
+    where the connection-name is the key and the connection instance is
     the value.
 
     @return: dictionary with all connections used by the form
     """
 
     result = {}
-
-    for block in self._logic._blockList:
-      dLink = block._dataSourceLink
-      if not result.has_key (dLink.connection) and \
-          dLink._connection is not None:
-        result [dLink.connection] = dLink._connection
-
+    for dLink in self._datasourceDictionary.values():
+      try:
+        if dLink._connection is not None:
+          result [dLink.connection] = dLink._connection
+      except AttributeError:
+        pass
+        
+    
     return result
 
 
@@ -1155,6 +1156,16 @@
   #===========================================================================
 
   #---------------------------------------------------------------------------
+  # trigger commits
+  #---------------------------------------------------------------------------
+  def triggerCommit(self):
+    """
+    Causes the form to commit
+    """  
+    event = events.Event('endEDITMODE',_form=self)
+    self._instance.executeCommit(event)
+  
+  #---------------------------------------------------------------------------
   # display a standard message box
   #---------------------------------------------------------------------------
   def triggerShowMessageBox (self, msgtxt, caption='GNUe Message',



_______________________________________________
Commit-gnue mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/commit-gnue

Reply via email to