[Zope3-checkins] CVS: Zope3/src/zope/app/dav - configure.zcml:1.15
interfaces.py:1.2 propfind.py:1.16 widget.py:1.7
Garrett Smith
garrett at mojave-corp.com
Fri Mar 5 23:17:53 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/dav
In directory cvs.zope.org:/tmp/cvs-serv15646/src/zope/app/dav
Modified Files:
configure.zcml interfaces.py propfind.py widget.py
Log Message:
Merged changes from garrett-widgets2-branch:
- Changed the way widgets are looked up to use interfaces instead of
names.
- Refactor of zope/app/form/utility.py -- see
http://dev.zope.org/Zope3/WidgetsAndMultiwayAdapters
for details.
- Moved configuration of vocab widgets to its own zcml file
(zope/app/browser/form/vocabularywidget.zcml).
- Removed 'propertyNames' and 'getValue' from widgets. This is replaced
by accessing the widget attributes directly.
- Deleted depreated methods from widget interface: haveData and getData.
=== Zope3/src/zope/app/dav/configure.zcml 1.14 => 1.15 ===
--- Zope3/src/zope/app/dav/configure.zcml:1.14 Wed Mar 3 12:06:30 2004
+++ Zope3/src/zope/app/dav/configure.zcml Fri Mar 5 23:17:22 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.dav.interfaces.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.dav.interfaces.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.dav.interfaces.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.dav.interfaces.IDAVWidget"
factory="zope.app.dav.widget.SequenceDAVWidget"
- allowed_attributes="getData hasInput setRenderedValue __call__ __str__" />
+ permission="zope.Public"
+ />
<adapter
provides="zope.app.dav.interfaces.IDAVSchema"
=== Zope3/src/zope/app/dav/interfaces.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/dav/interfaces.py:1.1 Wed Mar 3 12:06:30 2004
+++ Zope3/src/zope/app/dav/interfaces.py Fri Mar 5 23:17:22 2004
@@ -27,7 +27,6 @@
provide this interface
"""
-
class IDAVCreationDate(Interface):
creationdate = Text(title=u'''Records the time and date the resource\
@@ -139,6 +138,7 @@
Last-Modified header in response to a
GET.''')
+
class IDAV1Schema(IGETDependentDAVSchema):
"""DAV properties required for Level 1 compliance"""
@@ -150,6 +150,7 @@
resources. The default value is
empty.''')
+
class IDAV2Schema(IDAV1Schema):
"""DAV properties required for Level 2 compliance"""
@@ -189,8 +190,14 @@
"""Full DAV properties schema"""
-class ISimpleDAVWidget(IWidget):
- """A specialized widget used to render DAV properties output (eg:
- for the response of a PROPFIND request)"""
+class IDAVWidget(IWidget):
+ """A specialized widget used to render DAV properties output."""
+
+
+class ITextDAVWidget(IDAVWidget):
+ """A DAV widget for text values."""
+
+class ISequenceDAVWidget(IDAVWidget):
+ """A DAV widget for sequences."""
=== Zope3/src/zope/app/dav/propfind.py 1.15 => 1.16 ===
--- Zope3/src/zope/app/dav/propfind.py:1.15 Fri Mar 5 17:09:01 2004
+++ Zope3/src/zope/app/dav/propfind.py Fri Mar 5 23:17:22 2004
@@ -18,7 +18,8 @@
from zope.schema import getFieldNamesInOrder
from zope.app import zapi
from zope.app.container.interfaces import IReadContainer
-from zope.app.form.utility import setUpWidgets, getWidgetsDataFromAdapter
+from zope.app.dav.interfaces import IDAVWidget
+from zope.app.form.utility import setUpWidgets
from interfaces import IDAVNamespace
@@ -105,10 +106,18 @@
prop.setAttribute('xmlns:%s' % attr_name, ns)
iface = _props[ns]['iface']
adapter = zapi.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.6 => 1.7 ===
--- Zope3/src/zope/app/dav/widget.py:1.6 Wed Mar 3 12:06:30 2004
+++ Zope3/src/zope/app/dav/widget.py Fri Mar 5 23:17:22 2004
@@ -15,17 +15,22 @@
$Id$
"""
-from zope.app.dav.interfaces import ISimpleDAVWidget
+
+from zope.app.dav.interfaces import IDAVWidget
+from zope.app.dav.interfaces import ITextDAVWidget
+from zope.app.dav.interfaces 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
@@ -36,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