[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Formulator - Field.py:1.1.2.1 FieldRegistry.py:1.1.2.1 IField.py:1.1.2.1 IInstanceFactory.py:1.1.2.1 IPropertyFieldAdapter.py:1.1.2.1 ISimpleRegistry.py:1.1.2.1 IValidator.py:1.1.2.1 IWidget.py:1.1.2.1 PropertyFieldAdapter.py:1.1.2.1 SimpleRegistry.py:1.1.2.1 Validator.py:1.1.2.1 ValidatorRegistry.py:1.1.2.1 Widget.py:1.1.2.1 Form.py:1.1.2.2.2.1 __init__.py:1.1.2.2.2.1 FormulatorProposal.stx:NONE FormulatorProposal2.stx:NONE

Stephan Richter srichter@cbu.edu
Fri, 1 Mar 2002 01:57:14 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/Formulator
In directory cvs.zope.org:/tmp/cvs-serv13304

Modified Files:
      Tag: srichter-OFS_Formulator-branch
	Form.py __init__.py 
Added Files:
      Tag: srichter-OFS_Formulator-branch
	Field.py FieldRegistry.py IField.py IInstanceFactory.py 
	IPropertyFieldAdapter.py ISimpleRegistry.py IValidator.py 
	IWidget.py PropertyFieldAdapter.py SimpleRegistry.py 
	Validator.py ValidatorRegistry.py Widget.py 
Removed Files:
      Tag: srichter-OFS_Formulator-branch
	FormulatorProposal.stx FormulatorProposal2.stx 
Log Message:
Checkin for new Formualtor layout. Much has changed since the initial
checkin:

- Both classes and instances of fields can be used as factory when creating
  views.

- Field: This object is simply a meta-data container for a piece of 
  information; for content objects these are usually its properties.

  Note: It is planned to have a CompositeField for more complex inputs, 
        such as dates.

- FieldViews are virtual objects; they are basically realized Widgets (or 
  Widgets in context)

- Validator: An object that validates data. Note that this object is 
  totally input/protocol-agnostic. Therefore the old concept of some of the
  Zope 2 Formulator validators is not applicable anymore.

- Widget: This is a generic component that is concerned about the 
  presentation of a field in a particular protocol. A difference to the 
  Zope 2 Formulator version is that the widget is also responsible of
  converting possible input-specific representation to a standard one. This
  is not yet fully implemented though.

- Form: A protocol-specific object that is concerned with the overall 
  representation of a form and its action.

- There is a Validator and Field Registry, since Fields and Validators can
  also be used independent of Formulator's goals. Fields should really 
  become the standard way to provide meta-data for properties.

Todo: (too much)

- I need to write a proper metaConfigure.py.

- Make a CompositeField.

- Create XUL Widgets.

- Clean up files.

- Finishing the conversion to the Zope 3 Formulator model.


=== Added File Zope3/lib/python/Zope/App/Formulator/Field.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# 
##############################################################################
"""

$Id: Field.py,v 1.1.2.1 2002/03/01 06:56:42 srichter Exp $
"""

from Persistence import Persistent
from IField import IField
from Zope.App.Formulator.Errors import ValidationError
from IInstanceFactory import IInstanceFactory


class Field(Persistent):
    """Base class of all fields.
    A field is an object consisting of a widget and a validator.
    """

    __implements__ = (
        IField,
        IInstanceFactory
        )

    propertyNames = ('id', 'validator', 'default', 'title', 'description',
                     'required')

    id = None
    validator = None
    default = None
    title = 'Field Title'
    description = 'Field Description'
    required = 0


    def __init__(self, context=None, **kw):
        self.realize(context)

        for name in self.propertyNames:
            if name in kw.keys():
                setattr(self, name, kw[name])


    def getErrorMessage(self, name):
        try:
            return self.validator.getMessage(name)
        except KeyError:
            if name in self.validator.messageNames:
                return getattr(self.validator, name)
            else:
                return "Unknown error: %s" % name


    ############################################################
    # Implementation methods for interface
    # Zope.App.Formulator.IField.

    def getValidator(self):
        '''See interface IField'''
        return self.validator


    def hasValue(self, id):
        '''See interface IField'''
        if id in self.propertyNames:
            return 1
        else:
            return 0


    def getValue(self, id, _default=None):
        '''See interface IField'''
        if id in self.propertyNames:
            return getattr(self, id)
        else:
            return _default


    def isRequired(self):
        '''See interface IField'''
        return hasattr(self, 'required') and getattr(self, 'required')


    def getErrorNames(self):
        '''See interface IField'''
        return self.validator.messageNames


    def getTales(self, id):
        '''See interface IField'''
        raise NotImplemented


    def isTALESAvailable(self):
        '''See interface IField'''
        raise NotImplemented


    def getOverride(self, id):
        '''See interface IField'''
        raise NotImplemented

    #
    ############################################################


    ############################################################
    # Implementation methods for interface
    # Zope.App.Formulator.IInstanceFactory.

    def __call__(self, context):
        '''See interface IInstanceFactory'''
        self.realize(context)
        return self
    

    def getContext(self):
        '''See interface IInstanceFactory'''
        return self.context


    def realize(self, context):
        '''See interface IInstanceFactory'''
        self.context = context
    #
    ############################################################


=== Added File Zope3/lib/python/Zope/App/Formulator/FieldRegistry.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# 
##############################################################################
"""

$Id: FieldRegistry.py,v 1.1.2.1 2002/03/01 06:56:42 srichter Exp $
"""


from SimpleRegistry import SimpleRegistry
from ISimpleRegistry import ISimpleRegistry
from IField import IField

class IFieldRegistry(ISimpleRegistry):
    """
    The Field Registry manages a list of all the fields available in Zope. A
    registry is useful at this point, since fields can be initialized and
    registered by many places.

    Note that it does not matter whether we have classes or instances as
    fields. If the fields are instances, they must implement
    IInstanceFactory.
    """
    pass


class FieldRegistry(SimpleRegistry):
    """ """

    __implements__ =  (IFieldRegistry,)


    def register(self, name, field):
        return SimpleRegistry.register(self, name, field)


FieldRegistry = FieldRegistry(IField)
registerField = FieldRegistry.register
getField = FieldRegistry.get


=== Added File Zope3/lib/python/Zope/App/Formulator/IField.py ===
# This software is subject to the provisions of the Zope Public License,
# Version 1.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS 
# FOR A PARTICULAR PURPOSE.


from Interface import Interface


class IField(Interface):
    """
    """

    def getValidator():
        """Return the validator of this field."""


    def getContext():
        """Return the context object of the field."""
        

    def hasValue(id):
        """Return true if the field defines such a value.
        """


    def getValue(id):
        """Get value for id."""


    def getOverride(id):
        """Get override method for id (not wrapped)."""


    def getTales(id):
        """Get tales expression method for id."""
    

    def isRequired():
        """Check whether this field is required (utility function)
        """    


    def getErrorNames():
        """Get error messages.
        """


    def isTALESAvailable():
        """Return true only if TALES is available.
        """



=== Added File Zope3/lib/python/Zope/App/Formulator/IInstanceFactory.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# 
##############################################################################
"""

$Id: IInstanceFactory.py,v 1.1.2.1 2002/03/01 06:56:42 srichter Exp $
"""


from Interface import Interface


class IInstanceFactory(Interface):
    """
    If the Instance Factory is implemented by an object, then this object
    can be used as factory for other components, such as Views.
    """

    def realize(context):
        """
        Relaizes an instance in a particular context/evironment. This
        method basically replaces __init__(context) for class-based
        factories.
        """


    def __call__(context):
        """
        Basically calls realize(context). However it must be implemented
        too, so that the factory is callable This method has to return the
        produced object.
        """

    def getContext():
        """
        Get the context of the realized instance.
        """


=== Added File Zope3/lib/python/Zope/App/Formulator/IPropertyFieldAdapter.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# 
##############################################################################
"""

$Id: IPropertyFieldAdapter.py,v 1.1.2.1 2002/03/01 06:56:42 srichter Exp $
"""


from Interface import Interface


class IPropertyFieldAdapter(Interface):
    """
    """

    def setPropertyInContext(value):
        """ """


    def getPropertyInContext():
        """ """


=== Added File Zope3/lib/python/Zope/App/Formulator/ISimpleRegistry.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# 
##############################################################################
"""

$Id: ISimpleRegistry.py,v 1.1.2.1 2002/03/01 06:56:42 srichter Exp $
"""

from Interface import Interface


class ISimpleRegistry(Interface):
    """
    The Simple Registry is minimal collection of registered objects. This can
    be useful, when it is expected that objects of a particular type are added
    from many places in the system (through 3rd party products for example).

    A good example for this are the Formulator fields. While the basic types
    are defined inside the Formulator tree, other parties might add many
    more later on in their products, so it is useful to provide a registry via
    ZCML that allows to collect these items.

    There is only one constraint on the objects. They all must implement a
    particular interface specified during the initialization of the registry.

    Note that it does not matter whether we have classes or instances as
    objects. If the objects are instances, they must implement simply
    IInstanceFactory.
    """

    def register(name, object):
        """
        Registers the object under the id name.
        """


    def getF(name):
        """
        This returns the object with id name.
        """


=== Added File Zope3/lib/python/Zope/App/Formulator/IValidator.py ===
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# 
##############################################################################
"""

$Id: IValidator.py,v 1.1.2.1 2002/03/01 06:56:42 srichter Exp $
"""

from Interface import Interface


class IValidator(Interface):
    """A field validator provides the functionality to verify the
       input data on the server. 

       This class will be initialized as a singleton.
    """

    def validate(field, value):
        """Validate the value, knowing the field.
        """

    def raiseError(errorKey, field):
        """Raises the error, if the validation fails.
        """


=== Added File Zope3/lib/python/Zope/App/Formulator/IWidget.py ===
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# 
##############################################################################
"""

$Id: IWidget.py,v 1.1.2.1 2002/03/01 06:56:42 srichter Exp $
"""

from Interface import Interface


class IWidget(Interface):
    """Generically describes the behavior of a widget.

    The widget defines a list of propertyNames, which describes
    what properties of the widget are available to use for
    constructing the widget render output.

    Note that this level must be still presentation independent.
    """

    def getValue(name):
        """Look up a Widget setting (value) by name."""


    def getContext():
        """Get the context of the widget, namely the Field."""


=== Added File Zope3/lib/python/Zope/App/Formulator/PropertyFieldAdapter.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# 
##############################################################################
"""

$Id: PropertyFieldAdapter.py,v 1.1.2.1 2002/03/01 06:56:42 srichter Exp $
"""

from IPropertyFieldAdapter import IPropertyFieldAdapter
from Zope.App.Formulator.Errors import ValidationError


class PropertyFieldAdapter:
    """ """

    __implements__ = IPropertyFieldAdapter


    def __init__(self, context):
        """ """
        self.context = context


    def setPropertyInContext(self, value):
        """ """
        field = self.getContext()
        method = getattr(field.getContext(),
                        'set'+field.id[0].capitalize()+field.id[1:], None)
        apply(method, (value,))


    def getPropertyInContext(self):
        """ """
        field = self.getContext()
        print field
        method = getattr(field.getContext(),
                        'get'+field.id[0].capitalize()+field.id[1:], None)
        return apply(method, ())


    def getContext(self):
        """ """
        return self.context


=== Added File Zope3/lib/python/Zope/App/Formulator/SimpleRegistry.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# 
##############################################################################
"""

$Id: SimpleRegistry.py,v 1.1.2.1 2002/03/01 06:56:42 srichter Exp $
"""

from Zope.Configuration.name import resolve
from ISimpleRegistry import ISimpleRegistry
from Interface import implements
from types import StringTypes, ListType, TupleType
ListTypes = (TupleType, ListType)


class ZopeDuplicateRegistryEntryError(Exception):
    """
    This Error is raised when the user tries to add an object with 
    a name that already exists in the registry. Therefore,
    overwriting is not allowed.
    """

    def __init__(self, name):
        """Initializes Error"""
        self.name = name


    def __str__(self):
        """Returns string representation of Error"""
        return "The name '%s' is already defined in this registry." \
               %self.name



class ZopeIllegalInterfaceError(Exception):
    """
    This Error is thrown, when the passed object does not implement
    the specified interface.
    """

    def __init__(self, name, interface):
        """Initalize Error"""
        self.name = name
        self.interface = interface


    def __str__(self):
        """Returns string representation of Error"""
        return ( "The object with name " + self.name + " does not implement "
                 "the interface " + self.interface.__name__ + "." )



class SimpleRegistry:
    """ """

    __implements__ =  (ISimpleRegistry,)


    def __init__(self, interface):
        """Initialize registry"""
        self.objects = {}
        self.interface = interface
        

    ############################################################
    # Implementation methods for interface
    # Zope.App.Formulator.ISimpleRegistry

    def register(self, name, object):
        '''See interface ISimpleRegistry'''

        object = resolve(object)

        if name in self.objects.keys():
            raise ZopeDuplicateRegistryEntryError(name)

        # XXX Find the right Interface tools to do that; unfortunately,
        #     I have not found them
        # Check whether the object implements the right interface.
        # Note, that we do *not* know whether the object is an instance
        # or a class (or worse a Persistent class)
        if hasattr(object, '__implements__') and \
               ( self.interface == object.__implements__ or \
                 ( type(object.__implements__) in ListTypes and
                   self.interface in object.__implements__ ) ):
            self.objects[name] = object

        else:
            raise ZopeIllegalInterfaceError(name, self.interface)

        return []


    def get(self, name):
        '''See interface ISimpleRegistry'''
        if name in self.objects.keys():
            return self.objects[name]
        else:
            return None

    #
    ############################################################


=== Added File Zope3/lib/python/Zope/App/Formulator/Validator.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# 
##############################################################################
"""

$Id: Validator.py,v 1.1.2.1 2002/03/01 06:56:42 srichter Exp $
"""

from Zope.App.Formulator.Errors import ValidationError
from IValidator import IValidator
from IInstanceFactory import IInstanceFactory

class Validator:
    """Validates input and possibly transforms it to output.
    """

    __implements__ = (
        IValidator,
        IInstanceFactory
        )
    
    propertyNames = ['externalValidator']
    externalValidator = None
    
    messageNames = ['externalValidatorFailed']
    externalValidatorFailed = "The input failed the external validator."


    def __init__(self, **kw):
        """Initialize the Validator."""
        for name in self.propertyNames:
            if name in kw.keys():
                setattr(self, name, kw[name])

                
    def getMessage(self, name):
        """ """
        if name in self.messageNames:
            return getattr(self, name)


    ############################################################
    # Implementation methods for interface
    # Zope.App.Formulator.IValidator.

    def raiseError(self, errorKey, field):
        '''See interface IValidator'''
        raise ValidationError(errorKey, field)


    def validate(self, field, value):
        '''See interface IValidator'''
        pass
    #
    ############################################################


    ############################################################
    # Implementation methods for interface
    # Zope.App.Formulator.IInstanceFactory.

    def __call__(self, context):
        '''See interface IInstanceFactory'''
        self.realize(context)
        return self
    

    def getContext(self):
        '''See interface IInstanceFactory'''
        return self.context


    def realize(self, context):
        '''See interface IInstanceFactory'''
        self.context = context
    #
    ############################################################


=== Added File Zope3/lib/python/Zope/App/Formulator/ValidatorRegistry.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# 
##############################################################################
"""

$Id: ValidatorRegistry.py,v 1.1.2.1 2002/03/01 06:56:42 srichter Exp $
"""


from SimpleRegistry import SimpleRegistry
from ISimpleRegistry import ISimpleRegistry
from IValidator import IValidator

class IValidatorRegistry(ISimpleRegistry):
    """

    Note that it does not matter whether we have classes or instances as
    validators. If the validaotrs are instances, they must implement
    IInstanceFactory.
    """
    pass


class ValidatorRegistry(SimpleRegistry):
    """ """

    __implements__ =  (IValidatorRegistry,)

    def register(self, name, validator):
        return SimpleRegistry.register(self, name, validator)



ValidatorRegistry = ValidatorRegistry(IValidator)
registerValidator = ValidatorRegistry.register
getValidator = ValidatorRegistry.get


=== Added File Zope3/lib/python/Zope/App/Formulator/Widget.py ===
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# 
##############################################################################
"""

$Id: Widget.py,v 1.1.2.1 2002/03/01 06:56:42 srichter Exp $
"""
from IWidget import IWidget


class Widget:
    """I do not know what will be in this class, but it provides
    an extra layer.
    """

    __implements__ = IWidget

    propertyNames = []


    def __init__(self, field):
        """ """
        self._field = field


    def getValue(self, name):
        """ """
        if name in self.propertyNames:
            return getattr(self, name, None)


    def getContext(self):
        """ """
        return self._field


=== Zope3/lib/python/Zope/App/Formulator/Form.py 1.1.2.2 => 1.1.2.2.2.1 ===
 #from IForm import IForm
 from Zope.ComponentArchitecture import getRequestView
+from Zope.App.Formulator.IPropertyFieldAdapter import IPropertyFieldAdapter
+from Zope.App.Formulator.Errors import ValidationError
+from Zope.ComponentArchitecture import getAdapter
 
 
 class Form(AttributePublisher):
@@ -64,7 +67,7 @@
         if errors == []:
             for widget in self.getFieldViews(REQUEST):
                 field = widget.getContext()
-                field.setPropertyInContext(values[field.id])
+                getAdapter(field, IPropertyFieldAdapter).setPropertyInContext(values[field.id])
 
         return self.index(REQUEST, errors=errors)
 


=== Zope3/lib/python/Zope/App/Formulator/__init__.py 1.1.2.2 => 1.1.2.2.2.1 ===
 $Id$
 """
+
+
+from FieldRegistry import registerField, getField
+from ValidatorRegistry import registerValidator, getValidator

=== Removed File Zope3/lib/python/Zope/App/Formulator/FormulatorProposal.stx ===

=== Removed File Zope3/lib/python/Zope/App/Formulator/FormulatorProposal2.stx ===