[Zope3-checkins] CVS: Zope3/src/zope/app/dav - adapter.py:1.1.2.1 configure.zcml:1.5.2.1 globaldavschemaservice.py:1.2.2.1 propfind.py:1.3.2.1 widget.py:1.1.2.1
Grégoire Weber
zope@i-con.ch
Sun, 22 Jun 2003 10:23:59 -0400
Update of /cvs-repository/Zope3/src/zope/app/dav
In directory cvs.zope.org:/tmp/cvs-serv24874/src/zope/app/dav
Modified Files:
Tag: cw-mail-branch
adapter.py configure.zcml globaldavschemaservice.py
propfind.py widget.py
Log Message:
Synced up with HEAD
=== Zope3/src/zope/app/dav/adapter.py 1.1 => 1.1.2.1 ===
--- Zope3/src/zope/app/dav/adapter.py:1.1 Wed May 21 12:10:06 2003
+++ Zope3/src/zope/app/dav/adapter.py Sun Jun 22 10:22:58 2003
@@ -17,12 +17,11 @@
"""
from xml.dom import minidom
-from zope.component import getView, getAdapter, queryAdapter
-from zope.app.interfaces.traversing import IObjectName
+from zope.component import getAdapter, queryAdapter
from zope.app.interfaces.dublincore import IDCTimes
-from zope.app.interfaces.file import IReadFile
from zope.app.interfaces.file import IReadDirectory
from zope.app.interfaces.size import ISized
+from zope.app import zapi
class DAVSchemaAdapter:
@@ -30,8 +29,7 @@
self.context = object
def displayname(self):
- value = getAdapter(self.context, IObjectName)()
- return value
+ return zapi.name(self.context)
def creationdate(self):
value = getAdapter(self.context, IDCTimes).created
=== Zope3/src/zope/app/dav/configure.zcml 1.5 => 1.5.2.1 ===
--- Zope3/src/zope/app/dav/configure.zcml:1.5 Wed May 21 13:26:37 2003
+++ Zope3/src/zope/app/dav/configure.zcml Sun Jun 22 10:22:58 2003
@@ -15,8 +15,8 @@
name="view"
permission="zope.Public"
type="zope.publisher.interfaces.http.IHTTPPresentation"
- factory="zope.app.dav.widget.SimpleDAVWidget"
- allowed_attributes="getData haveData setData __call__"
+ factory="zope.app.dav.widget.TextDAVWidget"
+ allowed_attributes="getData haveData setData __call__ __str__"
/>
<defaultView
@@ -24,8 +24,8 @@
name="view"
permission="zope.Public"
type="zope.publisher.interfaces.http.IHTTPPresentation"
- factory="zope.app.dav.widget.SimpleDAVWidget"
- allowed_attributes="getData haveData setData __call__"
+ factory="zope.app.dav.widget.TextDAVWidget"
+ allowed_attributes="getData haveData setData __call__ __str__"
/>
<defaultView
@@ -33,8 +33,17 @@
name="view"
permission="zope.Public"
type="zope.publisher.interfaces.http.IHTTPPresentation"
- factory="zope.app.dav.widget.SimpleDAVWidget"
- allowed_attributes="getData haveData setData __call__"
+ factory="zope.app.dav.widget.TextDAVWidget"
+ allowed_attributes="getData haveData setData __call__ __str__"
+ />
+
+ <defaultView
+ for="zope.schema.interfaces.ISequence"
+ name="view"
+ permission="zope.Public"
+ type="zope.publisher.interfaces.http.IHTTPPresentation"
+ factory="zope.app.dav.widget.SequenceDAVWidget"
+ allowed_attributes="getData haveData setData __call__ __str__"
/>
<adapter
=== Zope3/src/zope/app/dav/globaldavschemaservice.py 1.2 => 1.2.2.1 ===
--- Zope3/src/zope/app/dav/globaldavschemaservice.py:1.2 Tue May 20 15:43:27 2003
+++ Zope3/src/zope/app/dav/globaldavschemaservice.py Sun Jun 22 10:22:58 2003
@@ -18,9 +18,10 @@
from zope.component.exceptions import ComponentLookupError
from zope.app.component.globalinterfaceservice import InterfaceService
from zope.app.interfaces.component import IGlobalDAVSchemaService
+from zope.interface import implements
class DAVSchemaService(InterfaceService):
- __implements__ = IGlobalDAVSchemaService
+ implements(IGlobalDAVSchemaService)
def __init__(self, data=None):
if data is None:
=== Zope3/src/zope/app/dav/propfind.py 1.3 => 1.3.2.1 ===
--- Zope3/src/zope/app/dav/propfind.py:1.3 Wed May 21 16:29:46 2003
+++ Zope3/src/zope/app/dav/propfind.py Sun Jun 22 10:22:58 2003
@@ -16,12 +16,13 @@
__metaclass__ = type
from xml.dom import minidom
-from zope.component import getAdapter, getView, queryView, queryAdapter
-from zope.proxy.context import ContextWrapper
-from zope.proxy.introspection import removeAllProxies
+from zope.component import getView, queryView, queryAdapter
+from zope.app.context import ContextWrapper
+from zope.proxy import removeAllProxies
from zope.schema import getFieldNamesInOrder
from zope.app.interfaces.container import IReadContainer
-from zope.app.dav.globaldavschemaservice import queryInterface, availableNamespaces, queryNamespace
+from zope.app.dav.globaldavschemaservice import availableNamespaces
+from zope.app.dav.globaldavschemaservice import queryInterface
from zope.app.form.utility import setUpWidgets, getWidgetsDataFromAdapter
class PROPFIND:
@@ -105,7 +106,8 @@
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))
+ initial = getWidgetsDataFromAdapter(
+ adapter, iface, names=avail.get(ns))
setUpWidgets(self, iface, initial=initial, \
names=avail.get(ns), force=True)
for p in avail.get(ns):
@@ -113,17 +115,19 @@
if ns is not None and ns != self.default_ns:
el.setAttribute('xmlns', attr_name)
prop.appendChild(el)
- value = getattr(self, p)()
+ value = getattr(self, p+'_widget')()
if isinstance(value, (unicode, str)):
- value = response.createTextNode(value) ## Get the widget value here
+ # Get the widget value here
+ value = response.createTextNode(value)
el.appendChild(value)
else:
if isinstance(removeAllProxies(value), minidom.Node):
el.appendChild(removeAllProxies(value))
else:
# Try to string-ify
- value = str(getattr(self, p))
- value = response.createTextNode(value) ## Get the widget value here
+ value = str(getattr(self, p+'_widget'))
+ # Get the widget value here
+ value = response.createTextNode(value)
el.appendChild(value)
if not_avail:
@@ -133,7 +137,7 @@
pstat.appendChild(prop)
status = response.createElement('status')
pstat.appendChild(status)
- text = response.createTextNode('HTTP/1.1 403 Forbidden')
+ text = response.createTextNode('HTTP/1.1 404 Not Found')
status.appendChild(text)
count = 0
for ns in not_avail.keys():
@@ -149,7 +153,7 @@
self._depthRecurse(ms)
- body = response.toxml('utf-8')
+ body = response.toxml().encode('utf-8')
request.response.setBody(body)
request.response.setStatus(207)
return body
@@ -169,7 +173,8 @@
pfind.setDepth(subdepth)
value = pfind.PROPFIND()
parsed = minidom.parseString(value)
- responses = parsed.getElementsByTagNameNS(self.default_ns, 'response')
+ responses = parsed.getElementsByTagNameNS(
+ self.default_ns, 'response')
for r in responses:
ms.appendChild(r)
=== Zope3/src/zope/app/dav/widget.py 1.1 => 1.1.2.1 ===
--- Zope3/src/zope/app/dav/widget.py:1.1 Wed May 21 12:10:06 2003
+++ Zope3/src/zope/app/dav/widget.py Sun Jun 22 10:22:58 2003
@@ -19,10 +19,11 @@
from zope.app.interfaces.dav import ISimpleDAVWidget
from zope.app.interfaces.form import IWidget
from zope.component.interfaces import IViewFactory
-from zope.app.form.widget import Widget, CustomWidget
+from zope.app.form.widget import Widget
+from zope.interface import implements
class SimpleDAVWidget(Widget):
- __implements__ = (ISimpleDAVWidget, IWidget, IViewFactory)
+ implements(ISimpleDAVWidget, IWidget, IViewFactory)
def haveData(self):
return 1
@@ -35,3 +36,11 @@
def __call__(self):
return self.getData()
+
+class TextDAVWidget(SimpleDAVWidget):
+ pass
+
+class SequenceDAVWidget(SimpleDAVWidget):
+
+ def __str__(self):
+ return u', '.join(self._data)