[Zope3-checkins] CVS: Zope3/src/zope/app/dav - configure.zcml:1.3 globaldavschemaservice.py:1.2

Sidnei da Silva sidnei@x3ng.com.br
Tue, 20 May 2003 15:43:57 -0400


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

Modified Files:
	configure.zcml globaldavschemaservice.py 
Log Message:
More work on DAV support. Got it mostly working, but I cannot commit before writing tests :) Also, added OPTIONS view, and whitespace cleanup here and there.

=== Zope3/src/zope/app/dav/configure.zcml 1.2 => 1.3 ===
--- Zope3/src/zope/app/dav/configure.zcml:1.2	Tue May 20 12:28:00 2003
+++ Zope3/src/zope/app/dav/configure.zcml	Tue May 20 15:43:27 2003
@@ -2,6 +2,25 @@
    xmlns='http://namespaces.zope.org/zope'
    xmlns:dav='http://namespaces.zope.org/zope/dav'>
 
+
+<!-- not finished yet
+<view for="*"
+ 	name="PROPFIND"
+	type="zope.publisher.interfaces.http.IHTTPPresentation"
+	factory=".propfind.PROPFIND"
+	permission="zope.ManageContent"
+	allowed_attributes="PROPFIND setDepth getDepth"
+/>
+
+<adapter
+     provides="zope.app.interfaces.dav.IDAVSchema"
+     for="*"
+     permission="zope.Public"
+     factory=".adapter.DAVSchemaAdapter"
+     />
+
+-->
+
 <serviceType
     id='DAVSchema'
     interface='zope.app.interfaces.component.IDAVSchemaService' />


=== Zope3/src/zope/app/dav/globaldavschemaservice.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/dav/globaldavschemaservice.py:1.1	Tue May 20 11:46:38 2003
+++ Zope3/src/zope/app/dav/globaldavschemaservice.py	Tue May 20 15:43:27 2003
@@ -15,17 +15,47 @@
 $Id$
 """
 
+from zope.component.exceptions import ComponentLookupError
 from zope.app.component.globalinterfaceservice import InterfaceService
 from zope.app.interfaces.component import IGlobalDAVSchemaService
 
 class DAVSchemaService(InterfaceService):
     __implements__ = IGlobalDAVSchemaService
 
+    def __init__(self, data=None):
+        if data is None:
+            data = {}
+        backref = {}
+        for k, v in data:
+            backref[v] = k
+        self.__backref = backref
+        super(DAVSchemaService, self).__init__(data)
+
+    def provideInterface(self, id, interface):
+        if not id:
+            id = "%s.%s" % (interface.__module__, interface.__name__)
+        self.__backref[interface] = id
+        super(DAVSchemaService, self).provideInterface(id, interface)
+
+    def availableNamespaces(self):
+        return super(DAVSchemaService, self).searchInterfaceIds('')
+
+    def getNamespace(self, interface):
+        ns = self.__backref.get(interface, None)
+        if ns is None:
+            raise ComponentLookupError(interface)
+
+    def queryNamespace(self, interface, default=None):
+        return self.__backref.get(interface, default)
+
 davSchemaService = DAVSchemaService()
 provideInterface = davSchemaService.provideInterface
 getInterface = davSchemaService.getInterface
 queryInterface = davSchemaService.queryInterface
 searchInterface = davSchemaService.searchInterface
+availableNamespaces = davSchemaService.availableNamespaces
+getNamespace = davSchemaService.getNamespace
+queryNamespace = davSchemaService.queryNamespace
 
 _clear = davSchemaService._clear