[Zope3-checkins] CVS: Zope3/src/zope/schema - interfaces.py:1.21
Jim Fulton
jim@zope.com
Sun, 1 Jun 2003 11:59:42 -0400
Update of /cvs-repository/Zope3/src/zope/schema
In directory cvs.zope.org:/tmp/cvs-serv25908/src/zope/schema
Modified Files:
interfaces.py
Log Message:
Moved ContextWrapper, getItem, getAttr, queryItem, and queryAttr
from zope.context to zope.app.context.
=== Zope3/src/zope/schema/interfaces.py 1.20 => 1.21 ===
--- Zope3/src/zope/schema/interfaces.py:1.20 Fri May 30 02:10:58 2003
+++ Zope3/src/zope/schema/interfaces.py Sun Jun 1 11:59:41 2003
@@ -62,35 +62,10 @@
containing a field. For example, when validating a value to be
set as an object attribute, it may be necessary for the field to
introspect the object's state. This means that the field needs to
- have access to the object when performing validation.
-
- We haven't really decided on the best way to approach providing
- access to objects in field methods and properties. We've thought
- of three approaches:
-
- 1. Always pass the object:
-
- field.validate(value, object)
-
- 2. Bind the field to the object with a context wrapper:
-
- field = ContextWrapper(field, object)
- field.validate(value)
-
- 3. Provide a specialized binding protocol:
+ have access to the object when performing validation::
bound = field.bind(object)
bound.validate(value)
-
- Options 2 and 3 allow us to use properties, but require an extra
- binding step.
-
- Option 1 and 3 will require a significant refactoring.
-
- Option 2 requires us to make field methods, or at least the
- validate method into ContextMethods, which is a bit intrusive.
-
- For now, we will use option 3.
"""