[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Forms - Widget.py:1.2

Stephan Richter srichter@cbu.edu
Tue, 16 Jul 2002 19:43:29 -0400


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

Modified Files:
	Widget.py 
Log Message:
Insert worked some more on Forms and their tests. I am not done yet, but my
last checkin broke stuff, so I am making this checkin to have the tests 
pass.


=== Zope3/lib/python/Zope/App/Forms/Widget.py 1.1 => 1.2 ===
         'See Zope.App.Forms.IWidget.IWidget'
         if name in self.propertyNames:
             return getattr(self, name, None)
+
+
+class CustomWidget(object):
+    """Custom Widget."""
+    __instance_implements__ = IWidget
+
+    def __init__(self, widget, **kw):
+        self.widget = widget
+        self.kw = kw
+        
+    def __call__(self, context, request):
+        instance = self.widget(context, request)
+        for item in self.kw.items():
+            setattr(instance, item[0], item[1])
+        return instance
+