[Zodb-checkins] CVS: Packages/SFTPGateway/src/ZConfig - schema.py:1.31

Fred L. Drake, Jr. fred at zope.com
Fri Jan 2 01:03:39 EST 2004


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

Modified Files:
	schema.py 
Log Message:
allow <import package="..."/> to support prefixes


=== Packages/SFTPGateway/src/ZConfig/schema.py 1.30 => 1.31 ===
--- Packages/SFTPGateway/src/ZConfig/schema.py:1.30	Fri Jan  2 00:35:03 2004
+++ Packages/SFTPGateway/src/ZConfig/schema.py	Fri Jan  2 01:03:08 2004
@@ -167,11 +167,17 @@
     def push_prefix(self, attrs):
         name = attrs.get("prefix")
         if name:
-            name = str(name)
-            if name.startswith(".") and self._prefixes:
+            if self._prefixes:
+                convert = self._registry.get("dotted-suffix")
+            else:
+                convert = self._registry.get("dotted-name")
+            try:
+                name = convert(name)
+            except ValueError, err:
+                self.error("not a valid prefix: %s (%s)"
+                           % (_srepr(name), str(err)))
+            if name[0] == ".":
                 prefix = self._prefixes[-1] + name
-            elif name.startswith("."):
-                self.error("prefix may not begin with '.'")
             else:
                 prefix = name
         elif self._prefixes:
@@ -306,6 +312,7 @@
         else:
             if os.path.dirname(file):
                 self.error("file may not include a directory part")
+            pkg = self.get_classname(pkg)
             src = self._loader.schemaComponentSource(pkg, file)
             if not self._schema.hasComponent(src):
                 self._schema.addComponent(src)




More information about the Zodb-checkins mailing list