[Zope3-checkins] CVS: Zope3/src/zope/schema/tests - test_objectfield.py:1.2

Dominik Huber dominik at projekt01.ch
Wed Dec 17 04:52:03 EST 2003


Update of /cvs-repository/Zope3/src/zope/schema/tests
In directory cvs.zope.org:/tmp/cvs-serv29657

Modified Files:
	test_objectfield.py 
Log Message:
Bugfix zope.schema._field.Object:
-----------------------------------------------------
Validation of object field fixed. Validate only attributes of the schema 
that are implemented as fields.


=== Zope3/src/zope/schema/tests/test_objectfield.py 1.1 => 1.2 ===
--- Zope3/src/zope/schema/tests/test_objectfield.py:1.1	Mon Nov 24 12:03:05 2003
+++ Zope3/src/zope/schema/tests/test_objectfield.py	Wed Dec 17 04:52:02 2003
@@ -18,7 +18,7 @@
 """
 from unittest import TestSuite, main, makeSuite
 from zope.i18n import MessageIDFactory
-from zope.interface import Interface, implements
+from zope.interface import Attribute, Interface, implements
 from zope.schema import Object, TextLine
 from zope.schema import errornames
 from zope.schema.fieldproperty import FieldProperty
@@ -42,7 +42,9 @@
         description=_(u"Bar description"),
         default=u"",
         required=False)
-
+        
+    attribute = Attribute("Test attribute, an attribute can't be validated.")    
+    
 
 class TestClass(object):
     
@@ -50,6 +52,7 @@
     
     _foo = u''
     _bar = u''
+    _attribute = u''
        
     def getfoo(self):
         return self._foo 
@@ -65,16 +68,26 @@
     def setbar(self, value):
         self._bar = value
         
-    bar = property(getbar, setbar, None, u'foo')   
+    bar = property(getbar, setbar, None, u'foo')
+    
+    def getattribute(self):
+        return self._attribute 
+        
+    def setattribute(self, value):
+        self._attribute = value
+        
+    attribute = property(getattribute, setattribute, None, u'attribute')
 
 
 class FieldPropertyTestClass(object):
     
     implements(ITestSchema)
     
+    
     foo = FieldProperty(ITestSchema['foo'])
     bar = FieldProperty(ITestSchema['bar'])
-    
+    attribute = FieldProperty(ITestSchema['attribute'])
+   
 
 class NotFullyImplementedTestClass(object):
     
@@ -82,6 +95,7 @@
     
     foo = FieldProperty(ITestSchema['foo'])
     # bar = FieldProperty(ITestSchema['bar']): bar is not implemented
+    # attribute
     
     
 class ObjectTest(FieldTestBase):




More information about the Zope3-Checkins mailing list