[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Formulator - CompositeWidget.py:1.1.2.1 ICompositeWidget.py:1.1.2.1 IWidget.py:1.1.2.2 Widget.py:1.1.2.2 __init__.py:1.1.2.2.2.2

Stephan Richter srichter@cbu.edu
Mon, 4 Mar 2002 01:05:56 -0500


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

Modified Files:
      Tag: srichter-OFS_Formulator-branch
	IWidget.py Widget.py __init__.py 
Added Files:
      Tag: srichter-OFS_Formulator-branch
	CompositeWidget.py ICompositeWidget.py 
Log Message:
- Started implementation of CompositeWidget. Note that CompositeField or 
  CompositeValidator don't make sense in the Zope 3 Formulator.

ToDo

- Finish up CompositeWidget

- Write tests

- Write a tutorial on how to use Formualtor in Zope 3

- Start implementing Converters, which are objects that convert protocol 
  native data into a basic presentable Python fornat. Note, that in Zope 2 
  the Validator was responsible for that as well. --> This was decided upon
  by Steve A., Kapil K. and Stephan R. in the zope3-dev IRC channel.



=== Added File Zope3/lib/python/Zope/App/Formulator/CompositeWidget.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: CompositeWidget.py,v 1.1.2.1 2002/03/04 06:05:25 srichter Exp $
"""

from ICompositeWidget import ICompositeWidget
from Widget import Widget


class CompositeWidget(Widget):
    """ """

    __implements__ = Widget.__implements__, ICompositeWidget

    # Page template that is ised to lay out sub-widgets
    template = None

    # List of Sub-Widgets
    widgets = None


    def render(self, REQUEST):
        """ """
        return apply(self.template, (REQUEST,))


    def render_hidden(self, REQUEST):
        """ """
        return apply(self.template, (REQUEST,), {'hidden': 1})


    def setWidget(self, name, widget):
        """ """
        if self.widgets is None:
            self.widgets = {}

        self.widgets[name] = widget


    def getWidget(self, name, _default=None):
        """ """
        if name in self.widgets.keys():
            return self.widgets[name]
        else:
            return _default


    def getWidgets(self):
        """ """
        return self.widgets


=== Added File Zope3/lib/python/Zope/App/Formulator/ICompositeWidget.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: ICompositeWidget.py,v 1.1.2.1 2002/03/04 06:05:25 srichter Exp $
"""

from IWidget import IWidget


class ICompositeWidget(IWidget):
    """ """


=== Zope3/lib/python/Zope/App/Formulator/IWidget.py 1.1.2.1 => 1.1.2.2 ===
     def getContext():
         """Get the context of the widget, namely the Field."""
+
+
+    def render():
+        """Render the widget. This will return the representation the
+           client will understand."""
+
+    def render_hidden():
+        """Render the widget as a hidden field. This will return the
+           representation the client will understand."""


=== Zope3/lib/python/Zope/App/Formulator/Widget.py 1.1.2.1 => 1.1.2.2 ===
         """ """
         return self._field
+
+
+    def render(self):
+        """ """
+        raise NotImplemented
+
+
+    def render_hidden(self):
+        """ """
+        raise NotImplemented


=== Zope3/lib/python/Zope/App/Formulator/__init__.py 1.1.2.2.2.1 => 1.1.2.2.2.2 ===
 #
-# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
+# 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.
@@ -14,7 +15,6 @@
 
 $Id$
 """
-
 
 from FieldRegistry import registerField, getField
 from ValidatorRegistry import registerValidator, getValidator