[Zope-Checkins] CVS: Zope3/lib/python/Schema - ErrorNames.py:1.2 _Field.py:1.3

Klaus Wölfel woelfel@aurora-systems.de
Tue, 25 Jun 2002 11:14:17 -0400


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

Modified Files:
	ErrorNames.py _Field.py 
Log Message:
Added tests for min_lenght and max_legth in StringFields and fixed a bug in lengthchecking.

=== Zope3/lib/python/Schema/ErrorNames.py 1.1 => 1.2 ===
-RequiredEmptyString = 'Required string is empty.'
-TooBig = 'Too Big.'
-TooSmall = 'Too Small.'
-TooLong = 'Too Long.'
-TooShort = 'Too Short.'
\ No newline at end of file
+RequiredMissing ='RequiredMissing'
+RequiredEmptyString = 'RequiredEmptyString'
+TooBig = 'TooBig'
+TooSmall = 'TooSmall'
+TooLong = 'TooLong'
+TooShort = 'TooShort'


=== Zope3/lib/python/Schema/_Field.py 1.2 => 1.3 ===
             raise ValidationError,ErrorNames.RequiredEmptyString
         length = len(value)
+
         if self.min_length is not None and length < self.min_length:
             raise ValidationError, ErrorNames.TooShort
-        if self.max_length is not None and length >= self.max_length:
+        if self.max_length is not None and length > self.max_length:
             raise ValidationError, ErrorNames.TooLong
 
 class Bool(Field):