commit-gnue
[Top][All Lists]
Advanced

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

r5454 - in trunk: gnue-appserver/src gnue-appserver/src/classrep gnue-ap


From: reinhard
Subject: r5454 - in trunk: gnue-appserver/src gnue-appserver/src/classrep gnue-appserver/src/language gnue-common/src/apps
Date: Mon, 22 Mar 2004 08:40:51 -0600 (CST)

Author: reinhard
Date: 2004-03-22 08:40:50 -0600 (Mon, 22 Mar 2004)
New Revision: 5454

Modified:
   trunk/gnue-appserver/src/classrep/Base.py
   trunk/gnue-appserver/src/classrep/SchemaSupport.py
   trunk/gnue-appserver/src/geasInstance.py
   trunk/gnue-appserver/src/geasSession.py
   trunk/gnue-appserver/src/geasSessionManager.py
   trunk/gnue-appserver/src/language/Object.py
   trunk/gnue-appserver/src/language/Session.py
   trunk/gnue-common/src/apps/i18n.py
   trunk/gnue-common/src/apps/plugin.py
Log:
Don't export our own exception class as "Exception" but rather as "gException".
Otherwise, standard exceptions can't be caught anymore with "except Exception".


Modified: trunk/gnue-appserver/src/classrep/Base.py
===================================================================
--- trunk/gnue-appserver/src/classrep/Base.py   2004-03-22 14:01:28 UTC (rev 
5453)
+++ trunk/gnue-appserver/src/classrep/Base.py   2004-03-22 14:40:50 UTC (rev 
5454)
@@ -28,12 +28,12 @@
 # Exceptions
 # =============================================================================
 
-class ClassRepositoryError (Exception):
+class ClassRepositoryError (gException):
   """
   This Exception is the base class for all repository exceptions
   """
   def __init__ (self, text):
-    Exception.__init__ (self, text)
+    gException.__init__ (self, text)
 
 
 class ItemNotFoundError (ClassRepositoryError):

Modified: trunk/gnue-appserver/src/classrep/SchemaSupport.py
===================================================================
--- trunk/gnue-appserver/src/classrep/SchemaSupport.py  2004-03-22 14:01:28 UTC 
(rev 5453)
+++ trunk/gnue-appserver/src/classrep/SchemaSupport.py  2004-03-22 14:40:50 UTC 
(rev 5454)
@@ -35,12 +35,12 @@
 # Exceptions: Base exception class
 # =============================================================================
 
-class SchemaSupportError (Exception):
+class SchemaSupportError (gException):
   """
   Base class for all exceptions of SchemaSupport
   """
   def __init__ (self, text):
-    Exception.__init__ (self, text)
+    gException.__init__ (self, text)
 
 
 class InvalidTypeError (SchemaSupportError):

Modified: trunk/gnue-appserver/src/geasInstance.py
===================================================================
--- trunk/gnue-appserver/src/geasInstance.py    2004-03-22 14:01:28 UTC (rev 
5453)
+++ trunk/gnue-appserver/src/geasInstance.py    2004-03-22 14:40:50 UTC (rev 
5454)
@@ -32,20 +32,20 @@
 # Exceptions
 # =============================================================================
 
-class DbValueError (Exception):
+class DbValueError (gException):
   def __init__ (self, propertyName, value):
     message = u_("Database returned invalid value '%(value)s' for property "
                  "'%(property)s'") \
               % {"value"   : repr (value),
                  "property": propertyName}
-    Exception.__init__ (self, message)
+    gException.__init__ (self, message)
 
-class PropertyValueError (Exception):
+class PropertyValueError (gException):
   def __init__ (self, propertyName, value):
     message = u_("Invalid value '%(value)s' for property '%(property)s'") \
               % {"value": repr (value),
                  "property": propertyName}
-    Exception.__init__ (self, message)
+    gException.__init__ (self, message)
 
 # =============================================================================
 # Instance class

Modified: trunk/gnue-appserver/src/geasSession.py
===================================================================
--- trunk/gnue-appserver/src/geasSession.py     2004-03-22 14:01:28 UTC (rev 
5453)
+++ trunk/gnue-appserver/src/geasSession.py     2004-03-22 14:40:50 UTC (rev 
5454)
@@ -62,7 +62,7 @@
 
     # check if user has access rights for this class
     if not self.__authAdapter.hasAccess (self, self.__user, classname):
-      raise Exception, _("Access to class '%s' denied") % classname
+      raise gException, u_("Access to class '%s' denied") % classname
 
     return self.sm.classes [classname]
 
@@ -152,7 +152,7 @@
     if self.__lists.has_key (list_id):
       return self.__lists [list_id]
     else:
-      raise Exception, _("Can't find a list with ID '%s'") % list_id
+      raise gException, u_("Can't find a list with ID '%s'") % list_id
 
   # ---------------------------------------------------------------------------
   # Count the number of objects in the list

Modified: trunk/gnue-appserver/src/geasSessionManager.py
===================================================================
--- trunk/gnue-appserver/src/geasSessionManager.py      2004-03-22 14:01:28 UTC 
(rev 5453)
+++ trunk/gnue-appserver/src/geasSessionManager.py      2004-03-22 14:40:50 UTC 
(rev 5454)
@@ -33,7 +33,7 @@
 # Exceptions
 # =============================================================================
 
-class AuthError (Exception):
+class AuthError (gException):
   pass
 
 # =============================================================================
@@ -75,7 +75,7 @@
     if self._sessions.has_key (sess_id):
       return self._sessions [sess_id]
     else:
-      raise Exception, _("Can't find a session with ID '%s'") % sess_id
+      raise gException, u_("Can't find a session with ID '%s'") % sess_id
 
   # ===========================================================================
   # official API functions

Modified: trunk/gnue-appserver/src/language/Object.py
===================================================================
--- trunk/gnue-appserver/src/language/Object.py 2004-03-22 14:01:28 UTC (rev 
5453)
+++ trunk/gnue-appserver/src/language/Object.py 2004-03-22 14:40:50 UTC (rev 
5454)
@@ -30,11 +30,11 @@
 # Exceptions
 # ===========================================================================
 
-class MemberNotFoundError (Exception):
+class MemberNotFoundError (gException):
   def __init__ (self, classname, member):
-    msg = _("Class '%(classname)s' has no member '%(member)s'") % \
-             {"classname": classname, "member": member}
-    Exception.__init__ (self, msg)
+    msg = u_("Class '%(classname)s' has no member '%(member)s'") % \
+          {"classname": classname, "member": member}
+    gException.__init__ (self, msg)
 
 
 # ===========================================================================

Modified: trunk/gnue-appserver/src/language/Session.py
===================================================================
--- trunk/gnue-appserver/src/language/Session.py        2004-03-22 14:01:28 UTC 
(rev 5453)
+++ trunk/gnue-appserver/src/language/Session.py        2004-03-22 14:40:50 UTC 
(rev 5454)
@@ -29,10 +29,10 @@
 # Exceptions
 # ===========================================================================
 
-class NoContextError (Exception):
+class NoContextError (gException):
   def __init__ (self, name):
-    msg = _("Cannot qualifiy name '%s', no context specified") % name
-    Exception.__init__ (self, name)
+    msg = u_("Cannot qualifiy name '%s', no context specified") % name
+    gException.__init__ (self, name)
 
 
 # ===========================================================================

Modified: trunk/gnue-common/src/apps/i18n.py
===================================================================
--- trunk/gnue-common/src/apps/i18n.py  2004-03-22 14:01:28 UTC (rev 5453)
+++ trunk/gnue-common/src/apps/i18n.py  2004-03-22 14:40:50 UTC (rev 5454)
@@ -148,7 +148,7 @@
 # unicode messages.
 # -----------------------------------------------------------------------------
 
-class uException (Exception):
+class gException (Exception):
   """
   The same as the builtin python Exception, but can handle messages that are
   unicode strings.  This exception is available as the builtin class
@@ -175,4 +175,4 @@
 __builtin__.__dict__['u_'] = utranslate
 __builtin__.__dict__['_'] = translate
 __builtin__.__dict__['o'] = outconv
-__builtin__.__dict__['Exception'] = uException
+__builtin__.__dict__['gException'] = gException

Modified: trunk/gnue-common/src/apps/plugin.py
===================================================================
--- trunk/gnue-common/src/apps/plugin.py        2004-03-22 14:01:28 UTC (rev 
5453)
+++ trunk/gnue-common/src/apps/plugin.py        2004-03-22 14:40:50 UTC (rev 
5454)
@@ -26,7 +26,6 @@
 """
 from types import *
 
-import exceptions
 import os
 
 from gnue.common.apps import GDebug
@@ -114,7 +113,7 @@
     try:
       test (m)
       return [m]
-    except exceptions.Exception, message:
+    except Exception, message:
       gDebug (1, _('Can\'t use module %(module)s: %(message)s') % \
                  {'module': m.__name__, 'message': message})
       return []
@@ -141,8 +140,9 @@
     try:
       test (m)
       return m
-    except message:
-      print 'Can\'t use module %s:', message
+    except Exception, message:
+      gDebug (1, _('Can\'t use module %(module)s: %(message)s') % \
+                 {'module': m.__name__, 'message': message})
       return None
 
   # Search all submodules





reply via email to

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