[Zodb-checkins] CVS: Packages/SFTPGateway/src/ZConfig - loader.py:1.29

Fred L. Drake, Jr. fred at zope.com
Sun Dec 28 20:18:02 EST 2003


Update of /cvs-repository/Packages/SFTPGateway/src/ZConfig
In directory cvs.zope.org:/tmp/cvs-serv29595

Modified Files:
	loader.py 
Log Message:
- introduce a more-specific error for resource loading errors when
  loading a schema component
- remove spurious reliance on Python 2.2 features


=== Packages/SFTPGateway/src/ZConfig/loader.py 1.28 => 1.29 ===
--- Packages/SFTPGateway/src/ZConfig/loader.py:1.28	Wed Dec 24 17:03:10 2003
+++ Packages/SFTPGateway/src/ZConfig/loader.py	Sun Dec 28 20:16:00 2003
@@ -153,21 +153,25 @@
         try:
             __import__(package)
         except ImportError, e:
-            raise ZConfig.SchemaError("could not load package %s: %s"
-                                      % (package, str(e)))
+            raise ZConfig.SchemaResourceError(
+                "could not load package %s: %s" % (package, str(e)),
+                filename=file,
+                package=package)
         pkg = sys.modules[package]
         if not hasattr(pkg, "__path__"):
-            raise ZConfig.SchemaError(
-                "import name does not refer to a package: " + `package`)
+            raise ZConfig.SchemaResourceError(
+                "import name does not refer to a package",
+                filename=file, package=package)
         for dir in pkg.__path__:
             dirname = os.path.abspath(dir)
             fn = os.path.join(dirname, file)
             if os.path.exists(fn):
                 return "file://" + urllib.pathname2url(fn)
         else:
-            raise ZConfig.SchemaError(
-                "schema component not found: %s (file='%s')"
-                % (package, file))
+            raise ZConfig.SchemaResourceError("schema component not found",
+                                              filename=file,
+                                              package=package,
+                                              path=pkg.__path__)
 
 
 class ConfigLoader(BaseLoader):
@@ -235,8 +239,7 @@
         parser.parse(matcher)
 
 
-class CompositeHandler(object):
-    __slots__ = '_handlers', '_convert'
+class CompositeHandler:
 
     def __init__(self, handlers, schema):
         self._handlers = handlers




More information about the Zodb-checkins mailing list