[Zope-CVS] SVN: zpkgtools/branches/fdrake-zconfig-branch/zpkgsetup/cfgparser.py avoid API that is not used

Fred L. Drake, Jr. fdrake at gmail.com
Tue Aug 30 17:25:06 EDT 2005


Log message for revision 38174:
  avoid API that is not used

Changed:
  U   zpkgtools/branches/fdrake-zconfig-branch/zpkgsetup/cfgparser.py

-=-
Modified: zpkgtools/branches/fdrake-zconfig-branch/zpkgsetup/cfgparser.py
===================================================================
--- zpkgtools/branches/fdrake-zconfig-branch/zpkgsetup/cfgparser.py	2005-08-30 21:18:59 UTC (rev 38173)
+++ zpkgtools/branches/fdrake-zconfig-branch/zpkgsetup/cfgparser.py	2005-08-30 21:25:06 UTC (rev 38174)
@@ -16,7 +16,8 @@
 
 # This is new:
 
-def cachedSchemaLoader(filename="schema.xml", package=None):
+def cachedSchemaLoader(filename="schema.xml", package=None,
+                       loader_factory=None):
     if package is None:
         frame = sys._getframe(1)
         __path__ = _get_path_from_frame(frame)
@@ -26,6 +27,8 @@
         __import__(package)
         __path__ = sys.modules[package].__path__
 
+    if loader_factory is None:
+        loader_factory = SchemaLoader
     cache = []
     def loadSchemaCache():
         if cache:
@@ -33,7 +36,7 @@
         for p in __path__:
             path = os.path.join(p, filename)
             if os.path.isfile(path):
-                schema = loadSchema(path)
+                schema = loader_factory().loadURL(path)
                 cache.append(schema)
                 return schema
         raise ValueError("could not locate schema %r for package %r (path=%r)"
@@ -63,12 +66,6 @@
 
 
 
-def loadSchema(url):
-    return SchemaLoader().loadURL(url)
-
-def loadSchemaFile(file, url=None):
-    return SchemaLoader().loadFile(file, url)
-
 def loadConfig(schema, url, overrides=()):
     return _get_config_loader(schema, overrides).loadURL(url)
 



More information about the Zope-CVS mailing list