[Zope3-checkins] CVS: Zope3/src/zope/app/dav - configure.zcml:1.12.6.1 propfind.py:1.12.28.1 widget.py:1.5.34.1

Garrett Smith garrett at mojave-corp.com
Thu Feb 26 00:11:25 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/dav
In directory cvs.zope.org:/tmp/cvs-serv25181/src/zope/app/dav

Modified Files:
      Tag: garrett-widgets2-branch
	configure.zcml propfind.py widget.py 
Log Message:
Yet another branch for widgets refactoring (YABFWR).


=== Zope3/src/zope/app/dav/configure.zcml 1.12 => 1.12.6.1 ===
--- Zope3/src/zope/app/dav/configure.zcml:1.12	Fri Feb 13 17:30:29 2004
+++ Zope3/src/zope/app/dav/configure.zcml	Thu Feb 26 00:10:54 2004
@@ -46,37 +46,37 @@
   
   -->
   
-  <defaultView
-      for="zope.schema.interfaces.IField"
-      name="view"
-      permission="zope.Public"
+  <view
       type="zope.publisher.interfaces.http.IHTTPRequest"
+      for="zope.schema.interfaces.IText"
+      provides="zope.app.interfaces.dav.IDAVWidget"
       factory="zope.app.dav.widget.TextDAVWidget"
-      allowed_attributes="getData hasInput setRenderedValue __call__ __str__" />
-  
-  <defaultView
-      for="zope.schema.interfaces.ITextLine"
-      name="view"
       permission="zope.Public"
+      />
+  
+  <view
       type="zope.publisher.interfaces.http.IHTTPRequest"
+      for="zope.schema.interfaces.ITextLine"
+      provides="zope.app.interfaces.dav.IDAVWidget"
       factory="zope.app.dav.widget.TextDAVWidget"
-      allowed_attributes="getData hasInput setRenderedValue __call__ __str__" />
-  
-  <defaultView
-      for="zope.schema.interfaces.IDatetime"
-      name="view"
       permission="zope.Public"
+      />
+  
+  <view
       type="zope.publisher.interfaces.http.IHTTPRequest"
+      for="zope.schema.interfaces.IDatetime"
+      provides="zope.app.interfaces.dav.IDAVWidget"
       factory="zope.app.dav.widget.TextDAVWidget"
-      allowed_attributes="getData hasInput setRenderedValue __call__ __str__" />
-  
-  <defaultView
-      for="zope.schema.interfaces.ISequence"
-      name="view"
       permission="zope.Public"
+      />
+  
+  <view
       type="zope.publisher.interfaces.http.IHTTPRequest"
+      for="zope.schema.interfaces.ISequence"
+      provides="zope.app.interfaces.dav.IDAVWidget"
       factory="zope.app.dav.widget.SequenceDAVWidget"
-      allowed_attributes="getData hasInput setRenderedValue __call__ __str__" />
+      permission="zope.Public"
+      />
   
   <adapter
       provides="zope.app.interfaces.dav.IDAVSchema"


=== Zope3/src/zope/app/dav/propfind.py 1.12 => 1.12.28.1 ===
--- Zope3/src/zope/app/dav/propfind.py:1.12	Sun Sep 21 13:32:04 2003
+++ Zope3/src/zope/app/dav/propfind.py	Thu Feb 26 00:10:54 2004
@@ -20,9 +20,10 @@
 from zope.proxy import removeAllProxies
 from zope.schema import getFieldNamesInOrder
 from zope.app.interfaces.container import IReadContainer
+from zope.app.interfaces.dav import IDAVWidget
 from zope.app.dav.globaldavschemaservice import availableNamespaces
 from zope.app.dav.globaldavschemaservice import queryInterface
-from zope.app.form.utility import setUpWidgets, getWidgetsDataFromAdapter
+from zope.app.form.utility import setUpWidgets
 
 class PROPFIND:
     """PROPFIND handler for all objects
@@ -107,10 +108,18 @@
                     prop.setAttribute('xmlns:%s' % attr_name, ns)
                 iface = _props[ns]['iface']
                 adapter = queryAdapter(self.context, iface, None)
-                initial = getWidgetsDataFromAdapter(
-                    adapter, iface, names=avail.get(ns))
-                setUpWidgets(self, iface, initial=initial, \
-                             names=avail.get(ns), force=True)
+                initial = {}
+                for name in avail.get(ns):
+                    attr = getattr(adapter, name, None)
+                    if attr is not None:
+                        if callable(attr):
+                            value = attr()
+                        else:
+                            value = attr
+                        initial[name] = value
+                setUpWidgets(self, iface, IDAVWidget,
+                    ignoreStickyValues=True, initial=initial, 
+                    names=avail.get(ns))
                 for p in avail.get(ns):
                     el = response.createElement('%s' % p )
                     if ns is not None and ns != self.default_ns:


=== Zope3/src/zope/app/dav/widget.py 1.5 => 1.5.34.1 ===
--- Zope3/src/zope/app/dav/widget.py:1.5	Wed Aug 13 17:28:30 2003
+++ Zope3/src/zope/app/dav/widget.py	Thu Feb 26 00:10:54 2004
@@ -16,17 +16,21 @@
 $Id$
 """
 
-from zope.app.interfaces.dav import ISimpleDAVWidget
+from zope.app.interfaces.dav import IDAVWidget
+from zope.app.interfaces.dav import ITextDAVWidget
+from zope.app.interfaces.dav import ISequenceDAVWidget
+
 from zope.app.interfaces.form import IWidget
 from zope.component.interfaces import IViewFactory
 from zope.app.form.widget import Widget
 from zope.interface import implements
 
-class SimpleDAVWidget(Widget):
-    implements(ISimpleDAVWidget, IWidget, IViewFactory)
+class DAVWidget(Widget):
+
+    implements(IDAVWidget)
 
     def hasInput(self):
-        return 1
+        return True
 
     def getInputValue(self):
         return self._data
@@ -37,10 +41,13 @@
     def __call__(self):
         return self.getInputValue()
 
-class TextDAVWidget(SimpleDAVWidget):
-    pass
+class TextDAVWidget(DAVWidget):
+
+    implements(ITextDAVWidget)
+
+class SequenceDAVWidget(DAVWidget):
 
-class SequenceDAVWidget(SimpleDAVWidget):
+    implements(ISequenceDAVWidget)
 
     def __str__(self):
         return u', '.join(self._data)




More information about the Zope3-Checkins mailing list