commit-gnue
[Top][All Lists]
Advanced

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

gnue/gnuef client/gfclient src/GFForm.py src/GF...


From: Jason Cater
Subject: gnue/gnuef client/gfclient src/GFForm.py src/GF...
Date: Fri, 11 May 2001 18:42:31 -0700

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    01/05/11 18:42:31

Modified files:
        gnuef/client   : gfclient 
        gnuef/src      : GFForm.py GFParser.py 

Log message:
        Added support to gnuef for connection definition files

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/client/gfclient.diff?cvsroot=OldCVS&tr1=1.39&tr2=1.40&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/GFForm.py.diff?cvsroot=OldCVS&tr1=1.91&tr2=1.92&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/GFParser.py.diff?cvsroot=OldCVS&tr1=1.23&tr2=1.24&r1=text&r2=text

Patches:
Index: gnue/gnuef/client/gfclient
diff -u gnue/gnuef/client/gfclient:1.39 gnue/gnuef/client/gfclient:1.40
--- gnue/gnuef/client/gfclient:1.39     Fri May 11 17:04:05 2001
+++ gnue/gnuef/client/gfclient  Fri May 11 18:42:30 2001
@@ -16,7 +16,7 @@
 #
 # Copyright (c) 2000 Free Software Foundation
 #
-# $Id: gfclient,v 1.39 2001/05/12 00:04:05 jcater Exp $
+# $Id: gfclient,v 1.40 2001/05/12 01:42:30 jcater Exp $
 #
 
 import pstats
@@ -37,6 +37,9 @@
 class GFClient(GClientApp, GFController):
 
 
+  #
+  # GClientApp() overrides
+  #
   VERSION = GFOptions.VERSION
   NAME = "GNUe Forms"
   COMMAND_OPTIONS = [ 
@@ -46,11 +49,13 @@
   SUMMARY = \
      "GNUe Forms is the primary user interface to the GNU Enterprise system."
 
+  # 
+  # Initialize the class
+  #
   def __init__(self):    
     GClientApp.__init__(self)
 
     self.ui_type = self.OPTIONS['user_interface']
-    self.profile = self.OPTIONS['profile']
 
     GFController.__init__(self)
 
@@ -434,7 +439,11 @@
 # old stuff still in use
 #
 
-  
+  #
+  # Run the client application
+  #
+  # GClientApp().run() override
+  #
   def run(self):    
             
     # assign form file from 1st free argument
@@ -484,7 +493,7 @@
     #
     # Build the form tree
     #
-    self._form = loadForm (fileHandle) 
+    self._form = loadForm (fileHandle, self.connections) 
     fileHandle.close()
 
     control = GFController()
Index: gnue/gnuef/src/GFForm.py
diff -u gnue/gnuef/src/GFForm.py:1.91 gnue/gnuef/src/GFForm.py:1.92
--- gnue/gnuef/src/GFForm.py:1.91       Fri May  4 16:27:03 2001
+++ gnue/gnuef/src/GFForm.py    Fri May 11 18:42:31 2001
@@ -71,11 +71,13 @@
 
     
   def initializeTree(self):
+      
     # set the initial focus
     self.walk(self.setInitialFocus)
 
     # Connect to the defined databases
     self.walk(self.initDatabaseObjects)
+    self.walk(self.initDataSources)
 
     # build the block list
     self.walk(self.initBlocks)
@@ -142,10 +144,23 @@
     if object.getObjectType() == 'GFLabel':
       object.initialize()
 
-  def initDatabaseObjects(self, object):
+  def initDataSources(self, object):
     if object.getObjectType() =='GFDataSource':
       self._datasourceDictionary[object.name]=object
+
+      # Should we load a connection definition?
+      # This is a temporary hack :(
+      if hasattr(object,'database') and not \
+        self._databaseDictionary.has_key(object.database) and \
+        self._connections.hasConnection(object.database): 
+        conn = self._connections.getConnection(object.database)
+        self._databaseDictionary[object.database] = GFDatabase()
+        self._databaseDictionary[object.database].name = object.database
+        for attr in conn.keys():  
+          self._databaseDictionary[object.database].__dict__[attr] = conn[attr]
+
       
+  def initDatabaseObjects(self, object):
     if object.getObjectType() =='GFDatabase':
       self._databaseDictionary[object.name]=object
 
Index: gnue/gnuef/src/GFParser.py
diff -u gnue/gnuef/src/GFParser.py:1.23 gnue/gnuef/src/GFParser.py:1.24
--- gnue/gnuef/src/GFParser.py:1.23     Fri May  4 16:27:03 2001
+++ gnue/gnuef/src/GFParser.py  Fri May 11 18:42:31 2001
@@ -46,8 +46,9 @@
 #  not want the loaded form to connect to databases, etc)
 #######################################################
 
-def loadForm(URL, initialize=1):
-  return loadXMLObject (URL, xmlFormsHandler, 'GFForm', 'form', initialize)
+def loadForm(URL, connections, initialize=1):
+  return loadXMLObject (URL, xmlFormsHandler, 'GFForm', 'form', 
+           initialize, attributes={"_connections": connections})  
 
 
 



reply via email to

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