[Zodb-checkins] CVS: Packages/ZConfig - schema.py:1.1.2.21

Fred L. Drake, Jr. fred@zope.com
Mon, 16 Dec 2002 13:37:52 -0500


Update of /cvs-repository/Packages/ZConfig
In directory cvs.zope.org:/tmp/cvs-serv20249

Modified Files:
      Tag: zconfig-schema-devel-branch
	schema.py 
Log Message:
Rename doSchemaError() to error(), sharing the same convention as the
ZConfig.cfgparser module.


=== Packages/ZConfig/schema.py 1.1.2.20 => 1.1.2.21 ===
--- Packages/ZConfig/schema.py:1.1.2.20	Mon Dec 16 13:22:49 2002
+++ Packages/ZConfig/schema.py	Mon Dec 16 13:37:52 2002
@@ -59,26 +59,26 @@
         attrs = dict(attrs)
         if name == "schema":
             if self._schema is not None:
-                self.doSchemaError("schema element improperly nested")
+                self.error("schema element improperly nested")
             self.start_schema(attrs)
         elif name in self._handled_tags:
             if self._schema is None:
-                self.doSchemaError(name + " element outside of schema")
+                self.error(name + " element outside of schema")
             getattr(self, "start_" + name)(attrs)
         elif name in self._cdata_tags:
             if self._schema is None:
-                self.doSchemaError(name + " element outside of schema")
+                self.error(name + " element outside of schema")
             if self._cdata is not None:
-                self.doSchemaError(name + " element improperly nested")
+                self.error(name + " element improperly nested")
             self._cdata = []
         else:
-            self.doSchemaError("Unknown tag " + name)
+            self.error("Unknown tag " + name)
 
     def characters(self, data):
         if self._cdata is not None:
             self._cdata.append(data)
         elif data.strip():
-            self.doSchemaError("unexpected non-blank character data: "
+            self.error("unexpected non-blank character data: "
                                + data.strip())
 
     def endElement(self, name):
@@ -95,7 +95,7 @@
 
     def endDocument(self):
         if self._schema is None:
-            self.doSchemaError("no schema found")
+            self.error("no schema found")
 
     # schema loading logic
 
@@ -112,7 +112,7 @@
             if name.startswith(".") and self._prefixes:
                 prefix = self._prefixes[-1] + name
             elif name.startswith("."):
-                self.doSchemaError("prefix may not begin with '.'")
+                self.error("prefix may not begin with '.'")
             else:
                 prefix = name
         elif self._prefixes:
@@ -155,7 +155,7 @@
     def start_sectiontype(self, attrs):
         name = attrs.get("type")
         if not name:
-            self.doSchemaError(
+            self.error(
                 "sectiontype name must not be omitted or empty")
         name = self._identifier(name)
         self.push_prefix(attrs)
@@ -173,7 +173,7 @@
     def start_section(self, attrs):
         type = attrs.get("type")
         if not type:
-            self.doSchemaError("section must specify type")
+            self.error("section must specify type")
         sectiontype = self._schema.gettype(type)
         maxOccurs, minOccurs, handler = self.get_common_info(attrs)
         any, name, attribute = self.get_name_info(attrs)
@@ -187,11 +187,11 @@
 
     def start_sectiongroup(self, attrs):
         if self._group is not None:
-            self.doSchemaError("sectiongroup elements cannot be nested")
+            self.error("sectiongroup elements cannot be nested")
         self.push_prefix(attrs)
         name = attrs.get("type")
         if not name:
-            self.doSchemaError("sectiongroup must be named")
+            self.error("sectiongroup must be named")
         self._group = info.GroupType(name)
         self._schema.addtype(self._group)
         self._stack.append(self._group)
@@ -204,7 +204,7 @@
     def start_key(self, attrs):
         name = attrs.get("name")
         if not name:
-            self.doSchemaError("key name may not be omitted or empty")
+            self.error("key name may not be omitted or empty")
         # run the keytype converter to make sure this is a valid key
         name = self._stack[-1].keytype(name)
         datatype = self._registry.get(attrs.get("datatype"))
@@ -235,7 +235,7 @@
         if minOccurs:
             minOccurs = int(minOccurs)
             if minOccurs > maxOccurs:
-                self.doSchemaError("minOccurs cannot be more than maxOccurs")
+                self.error("minOccurs cannot be more than maxOccurs")
         else:
             minOccurs = None
         handler = self.get_handler(attrs)
@@ -244,18 +244,18 @@
     def get_name_info(self, attrs):
         name = attrs.get("name")
         if not name:
-            self.doSchemaError("section name must be specified and non-empty")
+            self.error("section name must be specified and non-empty")
         aname = attrs.get("attribute")
         if aname:
             aname = self._identifier(aname)
         if name in ("*", "+"):
             if not aname:
-                self.doSchemaError(
+                self.error(
                     "container attribute must be specified and non-empty"
                     " when using '*' or '+' for a section name")
             return name, None, aname
         else:
             return None, self._identifier(name), aname
 
-    def doSchemaError(self, message):
+    def error(self, message):
         raise ZConfig.ConfigurationError(message)