commit-gnue
[Top][All Lists]
Advanced

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

r6303 - in trunk/gnue-common/src: apps schema/scripter


From: johannes
Subject: r6303 - in trunk/gnue-common/src: apps schema/scripter
Date: Thu, 16 Sep 2004 09:03:33 -0500 (CDT)

Author: johannes
Date: 2004-09-16 09:03:32 -0500 (Thu, 16 Sep 2004)
New Revision: 6303

Modified:
   trunk/gnue-common/src/apps/GBaseApp.py
   trunk/gnue-common/src/schema/scripter/Scripter.py
Log:
Replaced another bunch of handleStartupError () calls by an apropriate exception


Modified: trunk/gnue-common/src/apps/GBaseApp.py
===================================================================
--- trunk/gnue-common/src/apps/GBaseApp.py      2004-09-16 13:51:04 UTC (rev 
6302)
+++ trunk/gnue-common/src/apps/GBaseApp.py      2004-09-16 14:03:32 UTC (rev 
6303)
@@ -482,8 +482,8 @@
     for param in paramList:
       psplit = string.split(param,'=',1)
       if len(psplit) == 1:
-        self.handleStartupError ( \
-                                  'Parameter "%s" specified, but no value 
supplied.' % psplit[0] )
+        raise StartupError, \
+            'Parameter "%s" specified, but no value supplied.' % psplit[0]
       parameters[string.lower(psplit[0])] = psplit[1]
 
       GDebug.printMesg(2,'Param "%s"="%s" ' % \

Modified: trunk/gnue-common/src/schema/scripter/Scripter.py
===================================================================
--- trunk/gnue-common/src/schema/scripter/Scripter.py   2004-09-16 13:51:04 UTC 
(rev 6302)
+++ trunk/gnue-common/src/schema/scripter/Scripter.py   2004-09-16 14:03:32 UTC 
(rev 6303)
@@ -23,8 +23,9 @@
 from gnue.common import VERSION
 from gnue.common.schema import GSParser
 from gnue.common.utils.FileUtils import openResource
-from gnue.common.apps.GClientApp import GClientApp
+from gnue.common.apps.GClientApp import *
 from gnue.common.datasources import GDataSource, GConditions
+from gnue.common.apps import errors
 
 from time import strftime
 from string import join
@@ -43,10 +44,10 @@
 class Error (gException):
   pass
 
-class MissingKeyError (Error):
+class MissingKeyError (errors.ApplicationError):
   def __init__ (self, tableName):
     msg = u_("Data row of table '%s' has no key fields") % tableName
-    Error.__init__ (self, msg)
+    errors.ApplicationError.__init__ (self, msg)
 
 # =============================================================================
 # Load GNUe Schema Definition files and create a database schema for it
@@ -164,7 +165,7 @@
     """
 
     if not len (self.ARGUMENTS):
-      self.handleStartupError (_("No input file specified."))
+      raise StartupError, _("No input file specified.")
 
     try:
       self._files = []
@@ -173,22 +174,23 @@
         self._files.append (openResource (filename))
 
     except IOError:
-      self.handleStartupError (u_("Unable to open input file %s.") % filename)
+      raise StartupError, \
+          u_("Unable to open input file: %s") % errors.getException () [2]
 
 
     self.outfile = self.OPTIONS ['output']
 
     if self.OPTIONS ['file-only'] and self.outfile is None:
-      self.handleStartupError (_("Output to file only requested, but no "
-                                 "filename specified."))
+      raise StartupError, \
+          u_("Output to file only requested, but no filename specified.")
 
     self.__doSchema = self.OPTIONS ['mode'].lower () in ['both', 'schema']
     self.__doData   = self.OPTIONS ['mode'].lower () in ['both', 'data'] and \
                           not self.OPTIONS ['file-only']
 
     if not (self.__doSchema or self.__doData):
-      self.handleStartupError (_("Mode of operation must be one of "
-                                 "'both', 'schema' or 'data'."))
+      raise StartupError, \
+          u_("Mode of operation must be one of 'both', 'schema' or 'data'.")
 
     cName = self.OPTIONS ['connection']
     self.connection = self.connections.getConnection (cName)





reply via email to

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