commit-gnue
[Top][All Lists]
Advanced

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

gnue gnue-common/doc/GCommSpecifications.txt gn...


From: Jason Cater
Subject: gnue gnue-common/doc/GCommSpecifications.txt gn...
Date: Sun, 04 Nov 2001 13:36:33 -0500

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    01/11/04 13:36:33

Modified files:
        gnue-common/doc: GCommSpecifications.txt 
        gnue-common/src: GComm.py GConnections.py GDataObjects.py 
        gnue-common/src/dbdrivers/cxoracle: DBdriver.py 
        gnue-common/src/dbdrivers/db2: DBdriver.py 
        gnue-common/src/dbdrivers/geas: DBdriver.py 
        gnue-common/src/dbdrivers/informix: DBdriver.py 
        gnue-common/src/dbdrivers/ingres: DBdriver.py 
        gnue-common/src/dbdrivers/interbase: DBdriver.py 
        gnue-common/src/dbdrivers/mysql: DBdriver.py 
        gnue-common/src/dbdrivers/oracle: DBdriver.py 
        gnue-common/src/dbdrivers/popy: DBdriver.py 
        gnue-common/src/dbdrivers/postgresql: DBdriver.py 
        gnue-common/src/dbdrivers/psycopg: DBdriver.py 
        gnue-common/src/dbdrivers/pypgsql: DBdriver.py 
        gnue-common/src/dbdrivers/sapdb: DBdriver.py 
        gnue-common/src/dbdrivers/sybase: DBdriver.py 
        gnuef/src      : GFClient.py UIwxpython.py 

Log message:
        improvements to exception feedback system

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/doc/GCommSpecifications.txt.diff?cvsroot=OldCVS&tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/GComm.py.diff?cvsroot=OldCVS&tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/GConnections.py.diff?cvsroot=OldCVS&tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/GDataObjects.py.diff?cvsroot=OldCVS&tr1=1.25&tr2=1.26&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/dbdrivers/cxoracle/DBdriver.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/dbdrivers/db2/DBdriver.py.diff?cvsroot=OldCVS&tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/dbdrivers/geas/DBdriver.py.diff?cvsroot=OldCVS&tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/dbdrivers/informix/DBdriver.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/dbdrivers/ingres/DBdriver.py.diff?cvsroot=OldCVS&tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/dbdrivers/interbase/DBdriver.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/dbdrivers/mysql/DBdriver.py.diff?cvsroot=OldCVS&tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/dbdrivers/oracle/DBdriver.py.diff?cvsroot=OldCVS&tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/dbdrivers/popy/DBdriver.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/dbdrivers/postgresql/DBdriver.py.diff?cvsroot=OldCVS&tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/dbdrivers/psycopg/DBdriver.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/dbdrivers/pypgsql/DBdriver.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/dbdrivers/sapdb/DBdriver.py.diff?cvsroot=OldCVS&tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/dbdrivers/sybase/DBdriver.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/GFClient.py.diff?cvsroot=OldCVS&tr1=1.28&tr2=1.29&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/UIwxpython.py.diff?cvsroot=OldCVS&tr1=1.114&tr2=1.115&r1=text&r2=text

Patches:
Index: gnue/gnue-common/doc/GCommSpecifications.txt
diff -u gnue/gnue-common/doc/GCommSpecifications.txt:1.7 
gnue/gnue-common/doc/GCommSpecifications.txt:1.8
--- gnue/gnue-common/doc/GCommSpecifications.txt:1.7    Fri Nov  2 15:19:26 2001
+++ gnue/gnue-common/doc/GCommSpecifications.txt        Sun Nov  4 13:36:32 2001
@@ -98,31 +98,41 @@
 Features
 ========
 
-   * Exceptions
+ * Exceptions
    Python server handlers can use standard Python exceptions to
    signal errors.  The GComm adapters will translate these to
    whatever error mechanism that adapter provides.  Should the
    adapter provide named exceptions, then
 
+ * Short Circuit/Proxy Mode
+   GComm provides a "short circuit" mode so that two modules designed to
+   run as separate servers can be run under the same server instance and
+   access each others services without using an external protocol. In
+   other words, the two "servers" co-exist in the same python instance
+   and can use each others' services without the use of CORBA, XML-RPC,
+   or any other network-based protocol.
 
+   To use this feature, use the "proxy" interface.
 
+
+
                                                                  OpenOffice
                       Corba     Pyro   Java RMI  XML-RPC   SOAP     UNO
                      -------- -------- -------- -------- -------- --------
-Distributed Objects      X        X        X                          X
+Distributed Objects      X        X        X        -        ??       X
 
-Exceptions               X        X        X       ??       ??        X
+Exceptions               X        X        X        X        ??        X
 
-Pass simple types        X        X        X       X        X         X
-Pass aggegrate types     X        X        X       ??       ??        X
-Pass userdef types       X        X        X       ??       ??        X
+Pass simple types        X        X        X        X        X         X
+Pass aggegrate types     X        X        X        X        ??        X
+Pass userdef types       X        X        X        ??       ??        X
 
-Return simple types      X        X        X       ??       ??        X
-Return aggregate types   X        X        X       ??       ??        X
-Return userdef types     X        X        X       ??       ??        X
+Return simple types      X        X        X        ??       ??        X
+Return aggregate types   X        X        X        ??       ??        X
+Return userdef types     X        X        X        ??       ??        X
 
-Python Native                     X       ??        X        X
-Python Bindings          X        X       ??        X        X
+Python Native            -        X       ??        X        X        -
+Python Bindings          X        X       ??        X        X        -
 
 
 
@@ -138,10 +148,14 @@
 
   params = { 'host': 'myserver.mydomain',
              'port': 8765,
-             'protocol': 'https' }
+             'transport': 'https' }
 
   server = GComm.attach('xmlrpc', params)
+
+  reports = server.requestService('Reports')
+
+  reports.runReport()
+
+  server.close()
 
-#  Reports = server.requestService('Reports')
 
-  server.Reports.
Index: gnue/gnue-common/src/GComm.py
diff -u gnue/gnue-common/src/GComm.py:1.4 gnue/gnue-common/src/GComm.py:1.5
--- gnue/gnue-common/src/GComm.py:1.4   Thu Nov  1 22:37:49 2001
+++ gnue/gnue-common/src/GComm.py       Sun Nov  4 13:36:32 2001
@@ -32,17 +32,19 @@
 #
 # Attach to a client driver
 #
-def attach(driver, params):
+def attach(interface, params):
   try:
-    imp = __import__('gnue/common/commdrivers/%s')
+    driver = __import__('gnue/common/commdrivers/%s' % interface)
   except ImportError, mesg:
-    GDebug.printMesg(1,"Unable to import GComm Adapter '%s': \n%s" % 
(driver,mesg))
+    GDebug.printMesg(1, \
+       "Unable to import GComm Adapter '%s': \n%s" % (driver,mesg))
     raise InvalidAdapter, mesg
 
-  if not (hasattr(imp,'CLIENT') and imp.CLIENT):
-    raise NoClientAdapter, "GComm adapter '%s' does not support clients" % 
driver)
+  if not (hasattr(driver,'CLIENT') and driver.CLIENT):
+    raise NoClientAdapter, \
+           "GComm adapter '%s' does not support clients" % interface)
 
-  adapter = imp.Client()
+  adapter = driver.Client(params)
 
   return adapter
 
Index: gnue/gnue-common/src/GConnections.py
diff -u gnue/gnue-common/src/GConnections.py:1.19 
gnue/gnue-common/src/GConnections.py:1.20
--- gnue/gnue-common/src/GConnections.py:1.19   Tue Sep 18 23:23:20 2001
+++ gnue/gnue-common/src/GConnections.py        Sun Nov  4 13:36:32 2001
@@ -11,7 +11,7 @@
 # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
 # PURPOSE. See the GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public 
+# You should have received a copy of the GNU General Public
 # License along with program; see the file COPYING. If not, 
 # write to the Free Software Foundation, Inc., 59 Temple Place 
 # - Suite 330, Boston, MA 02111-1307, USA.
@@ -37,17 +37,21 @@
 import GLoginHandler
 from gnue.common import openResource
 
-class NotFoundError (StandardError): 
-  # Raised if a requested connection name does not  
+class Error(StandardError):
+  # Base error
+  pass
+
+class NotFoundError (Error):
+  # Raised if a requested connection name does not
   # exist in the Connections Definition File.
   pass
 
-class AdapterNotAvailable (StandardError):
+class AdapterNotAvailable (Error):
   # Raised if a provider is requested for which
   # the python libraries are not installed.
   pass
 
-class InvalidFormatError (StandardError):
+class InvalidFormatError (Error):
   # Raised if the Connections Definition File is
   # in an unreadable format.
   pass
@@ -59,84 +63,95 @@
 
     self._loginHandler = loginHandler
     self._parser = GConfigParser()
+    self._location = location
 
     GDebug.printMesg(1,'Conn File: "%s"' % location)
 
     fileHandle = openResource(location)
 
-    try: 
-      self._parser.readfp(fileHandle) 
-    except DuplicateSectionError: 
-      raise InvalidFormatError, 'The file has duplicate source definitions.'
-    except MissingSectionError: 
-      raise InvalidFormatError, 'The file has no source definitions.'
-    except: 
-      raise InvalidFormatError, 'The file cannot be parsed.'
+    try:
+      self._parser.readfp(fileHandle)
+    except DuplicateSectionError:
+      raise InvalidFormatError, \
+         'The connections file has duplicate source definitions.\n\nFile: %s' \
+            % location
+    except MissingSectionError:
+      raise InvalidFormatError, \
+         'The connections file has no source definitions.\n\nFile: %s' \
+            % location
+    except:
+      raise InvalidFormatError, \
+         'The connections file cannot be parsed.\n\nFile: %s' % location
 
     self._openConnections = {}
 
 
-  def setLoginHandler(self, loginHandler): 
+  def setLoginHandler(self, loginHandler):
     self._loginHandler = loginHandler
 
 
-  def hasConnectionParameters(self, connection_name): 
+  def hasConnectionParameters(self, connection_name):
     return self._parser.has_section(connection_name)
 
 
   def getConnectionParameter(self, connection_name, attribute, default=None):
-    if self._parser.has_section(connection_name): 
-      try: 
+    if self._parser.has_section(connection_name):
+      try:
         return self._parser.get(connection_name, attribute)
-      except: 
+      except:
         return default
-    else: 
-       raise NotFoundError
+    else:
+      raise NotFoundError, \
+         'The connections file does not contain a definition \n       for 
"%s".\n\nFile: %s' \
+            % (connection_name, self._location)
 
+
   #
-  # Returns an dictionary of dictionaries describing all connections: 
+  # Returns an dictionary of dictionaries describing all connections:
   #  {connection name: {att name: value}}
   #
-  def getAllConnectionParameters(self): 
+  def getAllConnectionParameters(self):
     rv = {}
-    for section in self._parser.sections(): 
+    for section in self._parser.sections():
        rv[section]={}
-       for att in self._parser.options(section): 
+       for att in self._parser.options(section):
          rv[section][att] = self._parser.get(section, att)
     return rv
 
   #
-  # Returns a dictionary describing a connection: 
+  # Returns a dictionary describing a connection:
   #  {att name: value}
   #
-  def getConnectionParameters(self, connection_name): 
+  def getConnectionParameters(self, connection_name):
     rv = {}
-    if self._parser.has_section(connection_name): 
-      for att in self._parser.options(connection_name): 
+    if self._parser.has_section(connection_name):
+      for att in self._parser.options(connection_name):
         rv[att] = self._parser.get(connection_name, att)
-    else: 
-      raise NotFoundError
+    else:
+      raise NotFoundError, \
+         'The connections file does not contain a definition \n       for 
"%s".\n\nFile: %s' \
+            % (connection_name, self._location)
 
     return rv
 
   #
-  # Add a connection entry (session specific; i.e., doesn't add 
-  # to the connections.conf file, but to the current instance's  
-  # list of available connections. 
+  # Add a connection entry (session specific; i.e., doesn't add
+  # to the connections.conf file, but to the current instance's
+  # list of available connections.
   #
   def addConnectionSpecification (self, name, parameters):
-    self._parser.remove_section(string.lower(name))  
+    self._parser.remove_section(string.lower(name))
     self._parser.add_section(string.lower(name))
-    for key in parameters.keys(): 
+    for key in parameters.keys():
       self._parser.set(string.lower(name), key, parameters[key])
 
 
   #
   # Return a database provider object
   #
-  def getDataObject(self, connection_name, connection_type): 
-    # This will throw a GConnections.NotFoundError if an unknown 
-    # connection name is specified.  The calling method should 
+  def getDataObject(self, connection_name, connection_type):
+    # This will throw a GConnections.NotFoundError if an unknown
+    # connection name is specified.  The calling method should
     # catch this exception and handle it properly (exit w/message)
     return _load_dbdriver(self.getConnectionParameter(connection_name, \
         'provider'), connection_type, self)
@@ -145,22 +160,22 @@
   #
   # Get a data connection for a specified database
   #
-  def requestConnection(self, dataObject, connection): 
+  def requestConnection(self, dataObject, connection):
     connection_name = string.lower(connection)
-    if self._openConnections.has_key(connection_name): 
+    if self._openConnections.has_key(connection_name):
 
       # If a database connetion has already been established, use it
       dataObject.setDataConnection(self._openConnections[connection_name])
       GDebug.printMesg(5,'Reusing data connection to %s' % connection_name)
 
-    else: 
+    else:
       attempts = 4
 
       GDebug.printMesg(5,'Getting new data connection to %s' % connection_name)
 
-      while attempts: 
+      while attempts:
 
-        try: 
+        try:
           # Ask the UI to prompt for our login data
           loginData = self._loginHandler.getLogin(
               [connection_name, 
self.getConnectionParameter(connection_name,'comment',''),
@@ -179,19 +194,20 @@
           # We're done!
           attempts = 0
 
-        except GDataObjects.LoginError, error: 
-          # Oops, they must have entered an invalid user/password.  
+        except GDataObjects.LoginError, error:
+          # Oops, they must have entered an invalid user/password.
           # Those silly users.
           attempts = attempts - 1
 
-          if not attempts: 
+          if not attempts:
             # Four times is plenty...
-            raise GDataObjects.LoginError, error
+            raise GDataObjects.LoginError, \
+               "Unable to log in after 4 attempts.\n\nError: %s" % error
 
         except GLoginHandler.UserCanceledLogin:
           # Guess they changed their minds. Treat as a login error.
-          raise GDataObjects.LoginError, "User canceled the login request" 
-      
+          raise GDataObjects.LoginError, "User canceled the login request."
+
 
 
 
@@ -203,19 +219,19 @@
   if sys.platform == 'win32':
     os.putenv('PYTHONCASEOK','1')
 
-  try: 
+  try:
     dbdriver = __import__("gnue/common/dbdrivers/%s/DBdriver" % (driver))
-  except ImportError, err: 
+  except ImportError, err:
     GDebug.printMesg(1,'ImportError importing driver %s' % (driver))
     GDebug.printMesg(1,err)
     raise GDataObjects.ProviderNotSupportedError, \
-       "No drivers found for provider '%s'" % driver
+       "No database driver found for provider type '%s'" % driver
 
-  try: 
+  try:
     dd = dbdriver.supportedDataObjects[type]()
     GDebug.printMesg (1,'Attaching to %s (%s)' % 
(driver,dd.__class__.__name__))
     return dd
-  except KeyError: 
+  except KeyError:
     raise GDataObjects.ObjectTypeNotAvailableError, \
        "DB Driver '%s' does not support source type '%s'" % (driver, type)
 
Index: gnue/gnue-common/src/GDataObjects.py
diff -u gnue/gnue-common/src/GDataObjects.py:1.25 
gnue/gnue-common/src/GDataObjects.py:1.26
--- gnue/gnue-common/src/GDataObjects.py:1.25   Fri Nov  2 14:51:54 2001
+++ gnue/gnue-common/src/GDataObjects.py        Sun Nov  4 13:36:32 2001
@@ -33,40 +33,44 @@
 import GConfig
 import string
 
-class LoginError(Exception): 
-  # Raised when invalid login user/pass was provided 
+class Error(StandardError):
+  # Base exception
+  pass
+
+class LoginError(Error):
+  # Raised when invalid login user/pass was provided
   # Client should attempt to get better information and
   # try again
   pass
 
-class ConnectError(Exception): 
+class ConnectError(Error):
   # Raised when connection data is invalid (e.g., host not found, etc).
   # Client should probably not attempt to relogin.  Exit gracefully
   # with a reason.
-  pass 
+  pass
 
-class ProviderNotSupportedError(Exception): 
-  # Raised when a datasource type is requested that the dbdriver 
+class ProviderNotSupportedError(Error):
+  # Raised when a datasource type is requested that the dbdriver
   # does not support (e.g., not all dbdrivers support raw sql mode.)
-  pass 
+  pass
 
-class ObjectTypeNotAvailableError(Exception): 
-  # Raised when a datasource type is requested that the dbdriver 
+class ObjectTypeNotAvailableError(Error):
+  # Raised when a datasource type is requested that the dbdriver
   # does not support (e.g., not all dbdrivers support raw sql mode.)
-  pass 
-
-class ReadOnlyError(Exception): 
-  # Raised when an attempt is made to update a read-only data object.
   pass
 
-class ConnectionError(Exception): 
-  # Raised when connection raises an exception.
+class ReadOnlyError(Error):
+  # Raised when an attempt is made to update a read-only data object.
   pass
 
-class MasterDetailFieldMismatch(Exception): 
-  # Raised when a the number of master fields doesn't match the 
+class MasterDetailFieldMismatch(Error):
+  # Raised when a the number of master fields doesn't match the
   # number of detail fields. (e.g., masterlink="id,subid"
   # and detaillink="id" would be a problem; must be 1:1)
+  pass
+
+class ConnectionError(Error):
+  # Generic error reading from the database connection
   pass
 
 
Index: gnue/gnue-common/src/dbdrivers/cxoracle/DBdriver.py
diff -u gnue/gnue-common/src/dbdrivers/cxoracle/DBdriver.py:1.1 
gnue/gnue-common/src/dbdrivers/cxoracle/DBdriver.py:1.2
--- gnue/gnue-common/src/dbdrivers/cxoracle/DBdriver.py:1.1     Tue Sep 18 
23:25:03 2001
+++ gnue/gnue-common/src/dbdrivers/cxoracle/DBdriver.py Sun Nov  4 13:36:32 2001
@@ -76,7 +76,7 @@
                    connectData['_password'], \
                    connectData['service']))
     except self._DatabaseError, value:
-      raise GDataObjects.ConnectionError, value
+      raise GDataObjects.ConnectError, value
 
     self._postConnect()
 
Index: gnue/gnue-common/src/dbdrivers/db2/DBdriver.py
diff -u gnue/gnue-common/src/dbdrivers/db2/DBdriver.py:1.6 
gnue/gnue-common/src/dbdrivers/db2/DBdriver.py:1.7
--- gnue/gnue-common/src/dbdrivers/db2/DBdriver.py:1.6  Tue Sep 18 23:23:20 2001
+++ gnue/gnue-common/src/dbdrivers/db2/DBdriver.py      Sun Nov  4 13:36:32 2001
@@ -16,10 +16,10 @@
 # write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
-# Copyright 2000 Free Software Foundation
+# Copyright 2000, 2001 Free Software Foundation
 #
 # FILE:
-# DSgedi.py
+# db2/DBdriver.py
 #
 # DESCRIPTION:
 # Driver to provide access to data stored in a DB2 database
@@ -31,7 +31,6 @@
 #     service=    This is the DB2 DSN for your connection  (required)
 #
 
-import DB2
 import string
 import sys
 
@@ -43,7 +42,13 @@
    import DBSIG_RecordSet, DBSIG_ResultSet, DBSIG_DataObject, \
           DBSIG_DataObject_SQL, DBSIG_DataObject_Object
 
+try:
+  import DB2
+except ImportError, message:
+  raise GConnections.AdapterNotInstalled, \
+         "Driver not installed: db2 for DB2 [%s]" % message
 
+
 class DB2_RecordSet(DBSIG_RecordSet):
   def _postChanges(self):
     values = []
@@ -75,7 +80,7 @@
                    dsn=connectData['service'])
       self.triggerExtensions = TriggerExtensions(self._dataConnection)
     except self._DatabaseError, value:
-      raise GDataObjects.ConnectionError, value
+      raise GDataObjects.ConnectError, value
 
 
 class DB2_DataObject_Object(DB2_DataObject, \
Index: gnue/gnue-common/src/dbdrivers/geas/DBdriver.py
diff -u gnue/gnue-common/src/dbdrivers/geas/DBdriver.py:1.18 
gnue/gnue-common/src/dbdrivers/geas/DBdriver.py:1.19
--- gnue/gnue-common/src/dbdrivers/geas/DBdriver.py:1.18        Wed Oct 24 
17:42:25 2001
+++ gnue/gnue-common/src/dbdrivers/geas/DBdriver.py     Sun Nov  4 13:36:32 2001
@@ -182,7 +182,7 @@
       self.ior = 
open(GConfig.get('GEASDIR')+"/var/run/geas-server.ior").readline()
     except (IOError), ex:
       GDebug.printMesg(1, "*** Error: ior file for geas was not found...  is 
geas running?")
-      raise GDataObjects.ConnectionError, 'Unable to connect to GEAS. Is it 
running?'
+      raise GDataObjects.ConnectError, 'Unable to connect to GEAS. Is it 
running?'
 
     self._factory = self.orb.string_to_object(self.ior)
     try:
Index: gnue/gnue-common/src/dbdrivers/informix/DBdriver.py
diff -u gnue/gnue-common/src/dbdrivers/informix/DBdriver.py:1.1 
gnue/gnue-common/src/dbdrivers/informix/DBdriver.py:1.2
--- gnue/gnue-common/src/dbdrivers/informix/DBdriver.py:1.1     Tue Sep 18 
23:25:03 2001
+++ gnue/gnue-common/src/dbdrivers/informix/DBdriver.py Sun Nov  4 13:36:32 2001
@@ -83,7 +83,7 @@
                    user=connectData['_username'], \
                    passwd=connectData['_password'])
     except self._DatabaseError, value:
-      raise GDataObjects.ConnectionError, value
+      raise GDataObjects.ConnectError, value
 
     self._postConnect()
 
Index: gnue/gnue-common/src/dbdrivers/ingres/DBdriver.py
diff -u gnue/gnue-common/src/dbdrivers/ingres/DBdriver.py:1.2 
gnue/gnue-common/src/dbdrivers/ingres/DBdriver.py:1.3
--- gnue/gnue-common/src/dbdrivers/ingres/DBdriver.py:1.2       Wed Sep 19 
19:50:59 2001
+++ gnue/gnue-common/src/dbdrivers/ingres/DBdriver.py   Sun Nov  4 13:36:32 2001
@@ -76,7 +76,7 @@
       self._dataConnection = SIG2api.connect(connectData['dbname'], \
                 user=connectData['_username'])
     except self._DatabaseError, value:
-      raise GDataObjects.ConnectionError, value
+      raise GDataObjects.ConnectError, value
 
     self._postConnect()
 
Index: gnue/gnue-common/src/dbdrivers/interbase/DBdriver.py
diff -u gnue/gnue-common/src/dbdrivers/interbase/DBdriver.py:1.1 
gnue/gnue-common/src/dbdrivers/interbase/DBdriver.py:1.2
--- gnue/gnue-common/src/dbdrivers/interbase/DBdriver.py:1.1    Tue Sep 18 
23:25:03 2001
+++ gnue/gnue-common/src/dbdrivers/interbase/DBdriver.py        Sun Nov  4 
13:36:32 2001
@@ -79,7 +79,7 @@
                  database=connectData['dbname'], \
                  host=connectData['host'])
     except self._DatabaseError, value:
-      raise GDataObjects.ConnectionError, value
+      raise GDataObjects.ConnectError, value
 
     self._postConnect()
 
Index: gnue/gnue-common/src/dbdrivers/mysql/DBdriver.py
diff -u gnue/gnue-common/src/dbdrivers/mysql/DBdriver.py:1.6 
gnue/gnue-common/src/dbdrivers/mysql/DBdriver.py:1.7
--- gnue/gnue-common/src/dbdrivers/mysql/DBdriver.py:1.6        Fri Nov  2 
14:51:54 2001
+++ gnue/gnue-common/src/dbdrivers/mysql/DBdriver.py    Sun Nov  4 13:36:32 2001
@@ -77,7 +77,7 @@
                    host=connectData['host'], 
                    db=connectData['dbname'])
     except self._DatabaseError, value:
-      raise GDataObjects.ConnectionError, value
+      raise GDataObjects.ConnectError, value
 
     self._beginTransaction()
     self._postConnect()
Index: gnue/gnue-common/src/dbdrivers/oracle/DBdriver.py
diff -u gnue/gnue-common/src/dbdrivers/oracle/DBdriver.py:1.7 
gnue/gnue-common/src/dbdrivers/oracle/DBdriver.py:1.8
--- gnue/gnue-common/src/dbdrivers/oracle/DBdriver.py:1.7       Tue Sep 18 
23:23:20 2001
+++ gnue/gnue-common/src/dbdrivers/oracle/DBdriver.py   Sun Nov  4 13:36:32 2001
@@ -76,7 +76,7 @@
                    connectData['_password'], \
                    connectData['service']))
     except self._DatabaseError, value:
-      raise GDataObjects.ConnectionError, value
+      raise GDataObjects.ConnectError, value
 
     self._postConnect()
 
Index: gnue/gnue-common/src/dbdrivers/popy/DBdriver.py
diff -u gnue/gnue-common/src/dbdrivers/popy/DBdriver.py:1.1 
gnue/gnue-common/src/dbdrivers/popy/DBdriver.py:1.2
--- gnue/gnue-common/src/dbdrivers/popy/DBdriver.py:1.1 Mon Sep 17 22:43:31 2001
+++ gnue/gnue-common/src/dbdrivers/popy/DBdriver.py     Sun Nov  4 13:36:32 2001
@@ -60,7 +60,7 @@
                              (connectData['_username'], 
connectData['_password'], connectData['host'], connectData['dbname']))
       self.triggerExtensions = TriggerExtensions(self._dataConnection)
     except self._DatabaseError, value:
-      raise GDataObjects.ConnectionError, value
+      raise GDataObjects.ConnectError, value
 
     self._postConnect()
 
Index: gnue/gnue-common/src/dbdrivers/postgresql/DBdriver.py
diff -u gnue/gnue-common/src/dbdrivers/postgresql/DBdriver.py:1.20 
gnue/gnue-common/src/dbdrivers/postgresql/DBdriver.py:1.21
--- gnue/gnue-common/src/dbdrivers/postgresql/DBdriver.py:1.20  Wed Sep 19 
15:32:34 2001
+++ gnue/gnue-common/src/dbdrivers/postgresql/DBdriver.py       Sun Nov  4 
13:36:32 2001
@@ -11,9 +11,9 @@
 # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
 # PURPOSE. See the GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public 
-# License along with program; see the file COPYING. If not, 
-# write to the Free Software Foundation, Inc., 59 Temple Place 
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
 # Copyright 2000, 2001 Free Software Foundation
@@ -22,7 +22,7 @@
 # postgresql/DBdriver.py
 #
 # DESCRIPTION:
-# Postgresql implementation of dbdriver using Python DB-SIG v2 
+# Postgresql implementation of dbdriver using Python DB-SIG v2
 # specification.
 #
 # NOTES:
@@ -39,6 +39,7 @@
 try:
   import pg
   import pgdb as SIG2api
+  from _pg import error as PGError   # This is so we can catch login errors
 except ImportError, message:
   raise GConnections.AdapterNotInstalled, \
          "Driver not installed: pygresql for PostgreSQL [%s]" % message
@@ -59,10 +60,10 @@
   #### NOTE:  Once PyGreSQL's .fetchone() bug is fixed, this method
   ####   should be deleted!  Also note the line in PG_DataObject.__init__.
   ####   Right now, we are having to preload *ALL* rows from a datasource.
-  def _loadNextRecord(self): 
+  def _loadNextRecord(self):
     GDebug.printMesg(5,'_loadNextRecord() for %s' % self._dataObject.table)
-    if self._cursor: 
-      try: 
+    if self._cursor:
+      try:
         rsall = self._cursor.fetchall()
       except self._dataObject._DatabaseError, err:
         raise GDataObjects.ConnectionError, err
@@ -90,29 +91,31 @@
         return 1
       else: 
         return 0
-    else: 
+    else:
       return 0
 ####
 
 
-class PG_DataObject(DBSIG_DataObject): 
+class PG_DataObject(DBSIG_DataObject):
   def __init__(self):
     DBSIG_DataObject.__init__(self)
-    self._DatabaseError = SIG2api.DatabaseError
+    self._DatabaseError = SIG2api.Error
     #### When the PyGreSQL's .fetchone() bug is fixed, delete following line
     self._resultSetClass = PG_ResultSet
 
 
   def connect(self, connectData={}):
     GDebug.printMesg(1,"Postgresql database driver initializing")
-    try: 
-      self._dataConnection = SIG2api.connect(user=connectData['_username'], 
-                   password=connectData['_password'], 
-                   host=connectData['host'], 
+    try:
+      self._dataConnection = SIG2api.connect(user=connectData['_username'],
+                   password=connectData['_password'],
+                   host=connectData['host'],
                    database=connectData['dbname'])
       self.triggerExtensions = TriggerExtensions(self._dataConnection)
+    except PGError, value:
+      raise GDataObjects.ConnectError, value
     except self._DatabaseError, value:
-      raise GDataObjects.ConnectionError, value
+      raise GDataObjects.ConnectError, value
 
     self._postConnect()
 
Index: gnue/gnue-common/src/dbdrivers/psycopg/DBdriver.py
diff -u gnue/gnue-common/src/dbdrivers/psycopg/DBdriver.py:1.1 
gnue/gnue-common/src/dbdrivers/psycopg/DBdriver.py:1.2
--- gnue/gnue-common/src/dbdrivers/psycopg/DBdriver.py:1.1      Mon Sep 17 
22:43:31 2001
+++ gnue/gnue-common/src/dbdrivers/psycopg/DBdriver.py  Sun Nov  4 13:36:32 2001
@@ -60,7 +60,7 @@
                                           (connectData['_username'], 
connectData['_password'], connectData['host'], connectData['dbname']))
       self.triggerExtensions = TriggerExtensions(self._dataConnection)
     except self._DatabaseError, value:
-      raise GDataObjects.ConnectionError, value
+      raise GDataObjects.ConnectError, value
 
     self._postConnect()
 
Index: gnue/gnue-common/src/dbdrivers/pypgsql/DBdriver.py
diff -u gnue/gnue-common/src/dbdrivers/pypgsql/DBdriver.py:1.1 
gnue/gnue-common/src/dbdrivers/pypgsql/DBdriver.py:1.2
--- gnue/gnue-common/src/dbdrivers/pypgsql/DBdriver.py:1.1      Tue Sep 18 
17:58:25 2001
+++ gnue/gnue-common/src/dbdrivers/pypgsql/DBdriver.py  Sun Nov  4 13:36:33 2001
@@ -60,7 +60,7 @@
                                           (connectData['_username'], 
connectData['_password'], connectData['host'], connectData['dbname']))
       self.triggerExtensions = TriggerExtensions(self._dataConnection)
     except self._DatabaseError, value:
-      raise GDataObjects.ConnectionError, value
+      raise GDataObjects.ConnectError, value
 
     self._postConnect()
 
Index: gnue/gnue-common/src/dbdrivers/sapdb/DBdriver.py
diff -u gnue/gnue-common/src/dbdrivers/sapdb/DBdriver.py:1.2 
gnue/gnue-common/src/dbdrivers/sapdb/DBdriver.py:1.3
--- gnue/gnue-common/src/dbdrivers/sapdb/DBdriver.py:1.2        Wed Sep 19 
19:51:00 2001
+++ gnue/gnue-common/src/dbdrivers/sapdb/DBdriver.py    Sun Nov  4 13:36:33 2001
@@ -19,7 +19,7 @@
 # Copyright 2000, 2001 Free Software Foundation
 #
 # FILE:
-# DBdriver.py
+# sapdb/DBdriver.py
 #
 # DESCRIPTION:
 # Driver to provide access to data via SAP's SAP-DB/Python Driver
@@ -80,7 +80,7 @@
                    host=connectData['host'], \
                    autocommit="off")
     except self._DatabaseError, value:
-      raise GDataObjects.ConnectionError, value
+      raise GDataObjects.ConnectError, value
 
     self._postConnect()
 
Index: gnue/gnue-common/src/dbdrivers/sybase/DBdriver.py
diff -u gnue/gnue-common/src/dbdrivers/sybase/DBdriver.py:1.1 
gnue/gnue-common/src/dbdrivers/sybase/DBdriver.py:1.2
--- gnue/gnue-common/src/dbdrivers/sybase/DBdriver.py:1.1       Tue Sep 18 
23:25:03 2001
+++ gnue/gnue-common/src/dbdrivers/sybase/DBdriver.py   Sun Nov  4 13:36:33 2001
@@ -85,7 +85,7 @@
                   user=connectData['_username'], \
                   passwd=connectData['_password'])
     except self._DatabaseError, value:
-      raise GDataObjects.ConnectionError, value
+      raise GDataObjects.ConnectError, value
 
     self._postConnect()
 
Index: gnue/gnuef/src/GFClient.py
diff -u gnue/gnuef/src/GFClient.py:1.28 gnue/gnuef/src/GFClient.py:1.29
--- gnue/gnuef/src/GFClient.py:1.28     Sun Oct  7 02:28:34 2001
+++ gnue/gnuef/src/GFClient.py  Sun Nov  4 13:36:33 2001
@@ -39,10 +39,10 @@
 
 from gnue.forms.GFInstance import *
 from gnue.forms.GFForm import *
-from gnue.forms.GFParser import loadForm 
+from gnue.forms.GFParser import loadForm
 from gnue.common import GDebug
-from gnue.common import GConfig
-from gnue.common.GClientApp import * 
+from gnue.common import GConfig, GDataObjects, GConnections
+from gnue.common.GClientApp import *
 from gnue.forms import VERSION
 
 class GFClient(GClientApp):
@@ -80,7 +80,7 @@
   #
   # GClientApp().run() override
   #
-  def run(self): 
+  def run(self):
 
     # assign form file from 1st free argument
     try:
@@ -93,7 +93,7 @@
 
 
     # Initialize user interface (defaults to gui)
-    #  If the DISPLAY var isn't set then switch to text 
+    #  If the DISPLAY var isn't set then switch to text
     if self.ui_type == 'gui'  :
       if os.environ.has_key('DISPLAY') or os.name != 'posix':
         from gnue.forms import UIwxpython
@@ -105,51 +105,67 @@
       from gnue.forms import UIpyncurses
       self._ui=UIpyncurses
 
-    if self.ui_type == 'text' : 
+    if self.ui_type == 'text' :
       from gnue.forms import UIcurses
       self._ui=UIcurses
 
     self.runForm(formfile, self.disableSplash)
 
 
-  def runFormFromTrigger(self, formFile): 
+  def runFormFromTrigger(self, formFile):
     self.runForm(formFile, disableSplash=1)
 
-  def runForm(self, formFile, disableSplash=0):    
-    #
-    # Create the instance
-    #
-    instance = GFInstance(self, self.getNextSerialNumber(), 
-        connections=self.connections, ui=self._ui, disableSplash=disableSplash)
-    self._formInstances[instance.getSerialNumber()] = instance 
-
-    #
-    # Assign the proper login handler based upon the user interface choice
-    #
-    self.getConnectionManager().setLoginHandler(self._ui.UILoginHandler())
-
-    #
-    # Build the form tree
-    #
-    drive = os.path.splitdrive(formFile) 
-    if len(drive[0]):
-      fileHandle = open(formFile,'r')
-    else:
-      fileHandle = urllib.urlopen(formFile)
-
-    form = loadForm (fileHandle, instance) 
-    fileHandle.close()
-
-    #
-    # Start the instance
-    #
-    instance.setForm(form)
-    instance.activate()
+  def runForm(self, formFile, disableSplash=0):
+    try:
+      #
+      # Create the instance
+      #
+      instance = GFInstance(self, self.getNextSerialNumber(),
+          connections=self.connections, ui=self._ui, 
disableSplash=disableSplash)
+      self._formInstances[instance.getSerialNumber()] = instance
+
+      #
+      # Assign the proper login handler based upon the user interface choice
+      #
+      self.getConnectionManager().setLoginHandler(self._ui.UILoginHandler())
+
+      #
+      # Build the form tree
+      #
+      drive = os.path.splitdrive(formFile)
+      if len(drive[0]):
+        fileHandle = open(formFile,'r')
+      else:
+        fileHandle = urllib.urlopen(formFile)
+
+      form = loadForm (fileHandle, instance)
+      fileHandle.close()
+
+      #
+      # Start the instance
+      #
+      instance.setForm(form)
+      instance.activate()
+
+    except GConnections.Error, mesg:
+      self.handleStartupError(mesg)
 
-  def getNextSerialNumber (self): 
+    except GDataObjects.ConnectError, mesg:
+      self.handleStartupError(\
+         "Unable to login to datasource.\n\n       %s" %mesg)
+
+    except GDataObjects.ConnectionError, mesg:
+      self.handleStartupError(\
+         "Error while communicating with datasource.\n\n       %s" %mesg)
+
+    except GDataObjects.Error, mesg:
+      self.handleStartupError(mesg)
+
+
+  def getNextSerialNumber (self):
      self._lastSerialNumber = self._lastSerialNumber + 1
      return self._lastSerialNumber
-      
+
 if __name__ == '__main__':
   GFClient().run()
 
Index: gnue/gnuef/src/UIwxpython.py
diff -u gnue/gnuef/src/UIwxpython.py:1.114 gnue/gnuef/src/UIwxpython.py:1.115
--- gnue/gnuef/src/UIwxpython.py:1.114  Fri Nov  2 18:00:29 2001
+++ gnue/gnuef/src/UIwxpython.py        Sun Nov  4 13:36:33 2001
@@ -49,8 +49,8 @@
 ## Use getWxApp() to get or create the
 ## single instance
 
-class GFwxApp(wxApp): 
-  def OnInit(self): 
+class GFwxApp(wxApp):
+  def OnInit(self):
     GDebug.printMesg(7,"WxApp initializing")
     wxInitAllImageHandlers()
     GDebug.printMesg(7,"WxApp initializing2")
@@ -115,7 +115,7 @@
 
     self.keyEvents = {WXK_PRIOR:  GFEvent('requestPREVBLOCK'),
                       WXK_NEXT:   GFEvent('requestNEXTBLOCK'),
-                      WXK_TAB:    GFEvent('requestNEXTENTRY'),                 
       
+                      WXK_TAB:    GFEvent('requestNEXTENTRY'),
                       WXK_LEFT:   GFEvent('requestCURSORLEFT'),
                       WXK_RIGHT:  GFEvent('requestCURSORRIGHT'),
                       WXK_END:    GFEvent('requestCURSOREND'),
@@ -930,12 +930,12 @@
   def __init__(self):
     self._wxapp = getWxApp()
 
-  def getLogin(self, loginData): 
+  def getLogin(self, loginData):
 
-    if len(loginData[1]): 
+    if len(loginData[1]):
 #      loginMesg = 'Login required for "%s" (%s)' % (loginData[1], 
loginData[0])
       loginMesg = 'Login required for "%s"' % (loginData[1])
-    else: 
+    else:
       loginMesg = 'Login required for %s' % (loginData[0])
 
     self.dlg = wxDialog(NULL, -1, "GNU Enterprise: Login")
@@ -972,7 +972,7 @@
            s.GetSize().GetWidth() + t.GetSize().GetWidth() + 10)   
 
       dlgWidth = getLargest(dlgWidth, \
-           s.GetSize().GetWidth() + t.GetSize().GetWidth() + 10) 
+           s.GetSize().GetWidth() + t.GetSize().GetWidth() + 10)
 
       xSpacing = getLargest(xSpacing, s.GetSize().GetWidth())
       ySpacing = getLargest(ySpacing, s.GetSize().GetHeight())
@@ -1007,19 +1007,19 @@
 
 
     # Create and position the logo
-    wxStaticBitmap(self.dlg,-1, bmp, 
+    wxStaticBitmap(self.dlg,-1, bmp,
                    wxPoint((dlgWidth-bmp.GetWidth())/2, 12),
                    wxSize(bmp.GetWidth(), bmp.GetHeight()))
 
 
     # Move the various widgets into position
     messageField.SetPosition(
-        wxPoint(dlgWidth/2 - messageField.GetSize().GetWidth()/2, 
+        wxPoint(dlgWidth/2 - messageField.GetSize().GetWidth()/2,
                 30 + bmp.GetHeight()))
 
 
     cancelButton.SetPosition(
-        wxPoint(dlgWidth - 10 - cancelButton.GetSize().GetWidth(), 
+        wxPoint(dlgWidth - 10 - cancelButton.GetSize().GetWidth(),
                 dlgHeight - 10 - getLargest(loginButton.GetSize().GetHeight(),
                                           cancelButton.GetSize().GetHeight())))
 
@@ -1043,8 +1043,11 @@
     self.dlg.ShowModal()
     self.dlg.Destroy()
 
+    if not self._completed:
+      raise GLoginHandler.UserCanceledLogin
+
     rv = {}
-    for i in range(0, len(loginData[2])): 
+    for i in range(0, len(loginData[2])):
       rv[loginData[2][i][0]] = self.textctrlList[i].GetValue()
 
     return rv
@@ -1052,20 +1055,20 @@
   #
   # Login is completed, for whatever reason
   #
-  def loginCompleted(self, successful): 
+  def loginCompleted(self, successful):
     self._completed = successful
     self.dlg.EndModal(1)
-        
+
   #
   # Called when user clicks "login"
   #
-  def loginButtonEventTrap(self, event): 
+  def loginButtonEventTrap(self, event):
     self.loginCompleted(1)
 
   #
-  # Called when user clicks "login"
+  # Called when user clicks "cancel"
   #
-  def loginCancelEventTrap(self, event): 
+  def loginCancelEventTrap(self, event):
     self.loginCompleted(0)
 
 



reply via email to

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