[Zope3-checkins] CVS: Zope3/src/ZConfig - loader.py:1.19 schema.py:1.21

Fred L. Drake, Jr. fred@zope.com
Thu, 10 Jul 2003 11:32:55 -0400


Update of /cvs-repository/Zope3/src/ZConfig
In directory cvs.zope.org:/tmp/cvs-serv5794

Modified Files:
	loader.py schema.py 
Log Message:
Remove unused (and useless) excuse for schema component extensions.
Related tests are also removed.
Something usable should still be added.


=== Zope3/src/ZConfig/loader.py 1.18 => 1.19 ===
--- Zope3/src/ZConfig/loader.py:1.18	Thu Feb 20 10:30:46 2003
+++ Zope3/src/ZConfig/loader.py	Thu Jul 10 11:32:18 2003
@@ -137,7 +137,7 @@
 
     # schema parser support API
 
-    def schemaComponentInfo(self, package):
+    def schemaComponentSource(self, package):
         parts = package.split(".")
         if not parts:
             raise ZConfig.SchemaError(
@@ -154,15 +154,7 @@
         else:
             raise ZConfig.SchemaError(
                 "schema component not found: " + `package`)
-        url = "file://" + urllib.pathname2url(fn)
-        extensions = []
-        for fn in os.listdir(dirname):
-            if fn == "component.xml":
-                continue
-            path = os.path.join(dirname, fn, "extension.xml")
-            if os.path.exists(path):
-                extensions.append("file://" + urllib.pathname2url(path))
-        return url, extensions
+        return "file://" + urllib.pathname2url(fn)
 
 
 class ConfigLoader(BaseLoader):


=== Zope3/src/ZConfig/schema.py 1.20 => 1.21 ===
--- Zope3/src/ZConfig/schema.py:1.20	Thu May  1 15:34:57 2003
+++ Zope3/src/ZConfig/schema.py	Thu Jul 10 11:32:18 2003
@@ -287,7 +287,8 @@
             src = url.urljoin(self._url, src)
             src, fragment = url.urldefrag(src)
             if fragment:
-                self.error("import src many not include a fragment identifier")
+                self.error("import src many not include"
+                           " a fragment identifier")
             schema = self._loader.loadURL(src)
             for n in schema.gettypenames():
                 self._schema.addtype(schema.gettype(n))
@@ -295,28 +296,21 @@
             # already loaded, or in progress
             pass
         else:
-            pi = self._loader.schemaComponentInfo(pkg)
-            if not pi:
+            src = self._loader.schemaComponentSource(pkg)
+            if not src:
                 self.error("could not locate schema component " + `pkg`)
-            self._components[pkg] = pi
-            self.loadComponent(pi)
+            self._components[pkg] = src
+            self.loadComponent(src)
 
-    def loadComponent(self, info):
-        base, extensions = info
-        r = self._loader.openResource(base)
-        parser = ComponentParser(self._registry, self._loader, base,
+    def loadComponent(self, src):
+        r = self._loader.openResource(src)
+        parser = ComponentParser(self._registry, self._loader, src,
                                  self._schema)
         parser._components = self._components
         try:
             xml.sax.parse(r.file, parser)
         finally:
             r.close()
-        for ext in extensions:
-            r = self._loader.openResource(ext)
-            try:
-                parser.loadExtension(r)
-            finally:
-                r.close()
 
     def end_import(self):
         pass
@@ -525,23 +519,4 @@
         self.push_prefix(attrs)
 
     def end_component(self):
-        self.pop_prefix()
-
-    def loadExtension(self, resource):
-        parser = ExtensionParser(self._registry, self._loader, resource.url,
-                                 self._parent, self._localtypes)
-        parser._components = self._components
-        xml.sax.parse(resource.file, parser)
-
-
-class ExtensionParser(BaseComponentParser):
-
-    _handled_tags = BaseComponentParser._handled_tags + ("extension",)
-    _top_level = "extension"
-
-    def start_extension(self, attrs):
-        self._schema = self._parent
-        self.push_prefix(attrs)
-
-    def end_extension(self):
         self.pop_prefix()