[Zope-Checkins] CVS: Zope3/lib/python/Schema - Converter.py:1.3 Exceptions.py:1.7 _Field.py:1.9

Stephan Richter srichter@cbu.edu
Wed, 17 Jul 2002 14:44:11 -0400


Update of /cvs-repository/Zope3/lib/python/Schema
In directory cvs.zope.org:/tmp/cvs-serv1727/lib/python/Schema

Modified Files:
	Converter.py Exceptions.py _Field.py 
Log Message:
Okay, I finally finished that Schema Demo code. See that 
SchemaTestObject.py file for more info.

You can also see the test page in every folder:
http://localhost:8080/testSchemaFormAction.html


=== Zope3/lib/python/Schema/Converter.py 1.2 => 1.3 ===
         try:
             return self._function(value)
         except Exception, e:
-            raise ConversionError('exception', e)
+            raise ConversionError('Conversion error', e)
         
 def _functionConverterFactory(klass_name, function):
     """Create a derived class of FunctionConvert which uses function.


=== Zope3/lib/python/Schema/Exceptions.py 1.6 => 1.7 ===
         return cmp(self.error_name, other.error_name)
 
 
-class ValidationErrorsAll(Exception):
-    """This is a collection error that contains all exceptions that occured
-    during the validation process."""
-
-    def __init__(self, list):
-        Exception.__init__(self)
-        self.errors = list
-
-
 class ConversionError(Exception):
     """If some conversion fails, this exception is raised."""
 
@@ -53,10 +44,29 @@
         self.original_exception = original_exception
 
 
-class ConversionErrorsAll(Exception):
+class ErrorContainer(Exception):
+    """ """
+
+    def __init__(self, errors):
+        Exception.__init__(self)
+        self.errors = errors
+
+    def __len__(self):
+        return len(self.errors)
+
+    def __getitem__(self, key):
+        return self.errors[key]
+
+    def __iter__(self):
+        return iter(self.errors)
+
+
+class ValidationErrorsAll(ErrorContainer):
+    """This is a collection error that contains all exceptions that occured
+    during the validation process."""
+
+
+class ConversionErrorsAll(ErrorContainer):
     """This is a collection error that contains all exceptions that occured
     during the conversion process."""
 
-    def __init__(self, list):
-        Exception.__init__(self)
-        self.errors = list


=== Zope3/lib/python/Schema/_Field.py 1.8 => 1.9 ===
 
 class Str(Field):
     """A field representing a Str."""
-    type = str
+    type = str, unicode
     min_length = None
     max_length = None