[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r7135 - trunk/gnue-common/src/apps
From: |
reinhard |
Subject: |
[gnue] r7135 - trunk/gnue-common/src/apps |
Date: |
Tue, 8 Mar 2005 15:02:26 -0600 (CST) |
Author: reinhard
Date: 2005-03-08 15:02:25 -0600 (Tue, 08 Mar 2005)
New Revision: 7135
Modified:
trunk/gnue-common/src/apps/checktype.py
trunk/gnue-common/src/apps/plugin.py
Log:
Use better exception classes.
Modified: trunk/gnue-common/src/apps/checktype.py
===================================================================
--- trunk/gnue-common/src/apps/checktype.py 2005-03-08 20:57:01 UTC (rev
7134)
+++ trunk/gnue-common/src/apps/checktype.py 2005-03-08 21:02:25 UTC (rev
7135)
@@ -35,7 +35,7 @@
# Exception definition
# -----------------------------------------------------------------------------
-class TypeError (gException):
+class TypeError (errors.SystemError):
"""
Raised when L{checktype} detects a wrong type.
@@ -78,7 +78,7 @@
'expected': self.__stringify (self.expected),
'actual' : self.__stringify (self.actual),
'value' : repr (self.value)}
- gException.__init__ (self, message)
+ errors.SystemError.__init__ (self, message)
# -----------------------------------------------------------------------------
Modified: trunk/gnue-common/src/apps/plugin.py
===================================================================
--- trunk/gnue-common/src/apps/plugin.py 2005-03-08 20:57:01 UTC (rev
7134)
+++ trunk/gnue-common/src/apps/plugin.py 2005-03-08 21:02:25 UTC (rev
7135)
@@ -61,8 +61,9 @@
import sys
import traceback
-from gnue.common.apps import i18n
+from gnue.common.apps import errors, i18n
+
# =============================================================================
# Exceptions
# =============================================================================
@@ -71,7 +72,7 @@
# Module loading error
# -----------------------------------------------------------------------------
-class LoadError (gException):
+class LoadError (errors.AdminError):
"""
Indicates a failure to load a given module. Raised by L{find}.
@@ -102,8 +103,9 @@
message = u_("Cannot find plugin %s") % self.name
self.detail = message
- gException.__init__ (self, message)
+ errors.AdminError.__init__ (self, message)
+
# -----------------------------------------------------------------------------
# List all available plugins
# -----------------------------------------------------------------------------
@@ -129,6 +131,7 @@
# Now recursively list the plugins
return __list (_base, _identifier)
+
# -----------------------------------------------------------------------------
# Find a plugin
# -----------------------------------------------------------------------------
@@ -167,6 +170,7 @@
else:
raise LoadError, (name, result)
+
# -----------------------------------------------------------------------------
# A list of all previously failed modules
# -----------------------------------------------------------------------------
@@ -176,11 +180,14 @@
# attempt.
__failed = {}
+
# -----------------------------------------------------------------------------
# Mapping of previously found plugins
# -----------------------------------------------------------------------------
+
__findCache = {}
+
# -----------------------------------------------------------------------------
# Find all modules and subpackages in a package
# -----------------------------------------------------------------------------
@@ -206,6 +213,7 @@
result = result + [subname]
return result
+
# -----------------------------------------------------------------------------
# Recursively list all plugins
# -----------------------------------------------------------------------------
@@ -244,6 +252,7 @@
result.update (__list (base + '.' + sub, identifier))
return result
+
# -----------------------------------------------------------------------------
# Recursively find first available plugin and return the module or a dictionary
# with the exceptions that occured
@@ -286,6 +295,7 @@
exceptions.update (result)
return exceptions
+
# -----------------------------------------------------------------------------
# Recursively search for a plugin and return the module or the exceptions that
# occured
@@ -335,6 +345,7 @@
exceptions.update (result)
return exceptions
+
# =============================================================================
# Self test code
# =============================================================================
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r7135 - trunk/gnue-common/src/apps,
reinhard <=