[Zope3-checkins] CVS: Zope3/src/zope/app/dav - metadirectives.py:1.1 configure.zcml:1.9 meta.zcml:1.2 metaconfigure.py:1.2
Stephan Richter
srichter@cosmos.phy.tufts.edu
Sat, 2 Aug 2003 13:26:48 -0400
Update of /cvs-repository/Zope3/src/zope/app/dav
In directory cvs.zope.org:/tmp/cvs-serv5264/dav
Modified Files:
configure.zcml meta.zcml metaconfigure.py
Added Files:
metadirectives.py
Log Message:
Implemented the 'dav' namepsace in the new ZCML style and added a directive
test.
Also converted zope/app/configure.zcml to new style.
=== Added File Zope3/src/zope/app/dav/metadirectives.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""'dav' ZCML namespace schemas
$Id: metadirectives.py,v 1.1 2003/08/02 17:26:12 srichter Exp $
"""
from zope.configuration.fields import GlobalObject
from zope.interface import Interface
from zope.schema import URI
class IProvideInterfaceDirective(Interface):
"""This directive assigns a new interface to a component. This interface
will be available via WebDAV for this particular component."""
for_ = URI(
title=u"Namespace",
description=u"Namespace under which this interface will be available"\
u"via DAV.",
required=True)
interface = GlobalObject(
title=u"Interface",
description=u"Specifies an interface/schema for DAV.",
required=True)
=== Zope3/src/zope/app/dav/configure.zcml 1.8 => 1.9 ===
--- Zope3/src/zope/app/dav/configure.zcml:1.8 Mon Jun 30 12:58:40 2003
+++ Zope3/src/zope/app/dav/configure.zcml Sat Aug 2 13:26:12 2003
@@ -1,119 +1,104 @@
-<zopeConfigure
- xmlns='http://namespaces.zope.org/zope'
- xmlns:dav='http://namespaces.zope.org/zope/dav'>
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:dav="http://namespaces.zope.org/dav">
+
+ <view
+ for="*"
+ name="PROPFIND"
+ type="zope.publisher.interfaces.http.IHTTPPresentation"
+ factory=".propfind.PROPFIND"
+ permission="zope.ManageContent"
+ allowed_attributes="PROPFIND setDepth getDepth" />
+
+ <view
+ for="zope.app.interfaces.http.INullResource"
+ name="MKCOL"
+ type="zope.publisher.interfaces.http.IHTTPPresentation"
+ factory=".mkcol.NullResource"
+ permission="zope.ManageContent"
+ allowed_attributes="MKCOL" />
+
+ <view
+ for="*"
+ name="MKCOL"
+ type="zope.publisher.interfaces.http.IHTTPPresentation"
+ factory=".mkcol.MKCOL"
+ permission="zope.ManageContent"
+ allowed_attributes="MKCOL" />
+
+
+ <!-- Disabled for now. Need to write tests before checking in.
+ <view
+ for="*"
+ name="MOVE"
+ type="zope.publisher.interfaces.http.IHTTPPresentation"
+ factory=".move.MOVE"
+ permission="zope.ManageContent"
+ allowed_attributes="MOVE" />
+
+ <view
+ for="*"
+ name="COPY"
+ type="zope.publisher.interfaces.http.IHTTPPresentation"
+ factory=".copy.COPY"
+ permission="zope.ManageContent"
+ allowed_attributes="COPY" />
+
+ -->
+
+ <defaultView
+ for="zope.schema.interfaces.IText"
+ name="view"
+ permission="zope.Public"
+ type="zope.publisher.interfaces.http.IHTTPPresentation"
+ factory="zope.app.dav.widget.TextDAVWidget"
+ allowed_attributes="getData haveData setData __call__ __str__" />
+
+ <defaultView
+ for="zope.schema.interfaces.ITextLine"
+ name="view"
+ permission="zope.Public"
+ type="zope.publisher.interfaces.http.IHTTPPresentation"
+ factory="zope.app.dav.widget.TextDAVWidget"
+ allowed_attributes="getData haveData setData __call__ __str__" />
+
+ <defaultView
+ for="zope.schema.interfaces.IDatetime"
+ name="view"
+ permission="zope.Public"
+ type="zope.publisher.interfaces.http.IHTTPPresentation"
+ 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
+ provides="zope.app.interfaces.dav.IDAVSchema"
+ for="*"
+ permission="zope.Public"
+ factory=".adapter.DAVSchemaAdapter" />
+
+ <serviceType
+ id="DAVSchema"
+ interface="zope.app.interfaces.component.IDAVSchemaService" />
+
+ <service
+ serviceType="DAVSchema"
+ permission="zope.Public"
+ component="zope.app.dav.globaldavschemaservice.davSchemaService" />
+
+ <dav:provideInterface
+ for="http://purl.org/dc/1.1"
+ interface="zope.app.interfaces.dublincore.IZopeDublinCore" />
+
+ <dav:provideInterface
+ for="DAV:"
+ interface="zope.app.interfaces.dav.IDAVSchema" />
-<view
- for="*"
- name="PROPFIND"
- type="zope.publisher.interfaces.http.IHTTPPresentation"
- factory=".propfind.PROPFIND"
- permission="zope.ManageContent"
- allowed_attributes="PROPFIND setDepth getDepth"
- />
-
-<view
- for="zope.app.interfaces.http.INullResource"
- name="MKCOL"
- type="zope.publisher.interfaces.http.IHTTPPresentation"
- factory=".mkcol.NullResource"
- permission="zope.ManageContent"
- allowed_attributes="MKCOL"
- />
-
-<view
- for="*"
- name="MKCOL"
- type="zope.publisher.interfaces.http.IHTTPPresentation"
- factory=".mkcol.MKCOL"
- permission="zope.ManageContent"
- allowed_attributes="MKCOL"
- />
-
-
-<!-- Disabled for now. Need to write tests before checking in.
-<view
- for="*"
- name="MOVE"
- type="zope.publisher.interfaces.http.IHTTPPresentation"
- factory=".move.MOVE"
- permission="zope.ManageContent"
- allowed_attributes="MOVE"
- />
-
-<view
- for="*"
- name="COPY"
- type="zope.publisher.interfaces.http.IHTTPPresentation"
- factory=".copy.COPY"
- permission="zope.ManageContent"
- allowed_attributes="COPY"
- />
-
--->
-
-<defaultView
- for="zope.schema.interfaces.IText"
- name="view"
- permission="zope.Public"
- type="zope.publisher.interfaces.http.IHTTPPresentation"
- factory="zope.app.dav.widget.TextDAVWidget"
- allowed_attributes="getData haveData setData __call__ __str__"
- />
-
-<defaultView
- for="zope.schema.interfaces.ITextLine"
- name="view"
- permission="zope.Public"
- type="zope.publisher.interfaces.http.IHTTPPresentation"
- factory="zope.app.dav.widget.TextDAVWidget"
- allowed_attributes="getData haveData setData __call__ __str__"
- />
-
-<defaultView
- for="zope.schema.interfaces.IDatetime"
- name="view"
- permission="zope.Public"
- type="zope.publisher.interfaces.http.IHTTPPresentation"
- 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
- provides="zope.app.interfaces.dav.IDAVSchema"
- for="*"
- permission="zope.Public"
- factory=".adapter.DAVSchemaAdapter"
- />
-
-
-<serviceType
- id='DAVSchema'
- interface='zope.app.interfaces.component.IDAVSchemaService'
- />
-
-<service
- serviceType='DAVSchema'
- permission='zope.Public'
- component='zope.app.dav.globaldavschemaservice.davSchemaService'
- />
-
-<dav:provideInterface
- for="http://purl.org/dc/1.1"
- interface="zope.app.interfaces.dublincore.IZopeDublinCore"
- />
-
-<dav:provideInterface
- for="DAV:"
- interface="zope.app.interfaces.dav.IDAVSchema"
- />
-
-</zopeConfigure>
+</configure>
=== Zope3/src/zope/app/dav/meta.zcml 1.1 => 1.2 ===
--- Zope3/src/zope/app/dav/meta.zcml:1.1 Tue May 20 11:46:38 2003
+++ Zope3/src/zope/app/dav/meta.zcml Sat Aug 2 13:26:12 2003
@@ -1,10 +1,11 @@
-<zopeConfigure xmlns='http://namespaces.zope.org/zope'>
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:meta="http://namespaces.zope.org/meta">
- <directives namespace="http://namespaces.zope.org/zope/dav">
- <directive name="provideInterface"
- attributes="for interface"
- handler=" zope.app.dav.metaconfigure.interface"
- />
- </directives>
+ <meta:directive
+ namespace="http://namespaces.zope.org/dav"
+ name="provideInterface"
+ schema=".metadirectives.IProvideInterfaceDirective"
+ handler=".metaconfigure.interface"/>
-</zopeConfigure>
+</configure>
=== Zope3/src/zope/app/dav/metaconfigure.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/dav/metaconfigure.py:1.1 Tue May 20 11:46:38 2003
+++ Zope3/src/zope/app/dav/metaconfigure.py Sat Aug 2 13:26:12 2003
@@ -11,20 +11,16 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""
+"""Configuration handlers for 'dav' namespace.
+
$Id$
"""
-
from zope.app.services.servicenames import DAVSchema
-from zope.app.component.metaconfigure import handler, resolveInterface
-from zope.configuration.action import Action
+from zope.app.component.metaconfigure import handler
def interface(_context, for_, interface):
- interface = resolveInterface(_context, interface)
- return [
- Action(
- discriminator = None,
+ _context.action(
+ discriminator = ('dav', 'provideInterface', for_, interface),
callable = handler,
- args = (DAVSchema, 'provideInterface', for_, interface)
- ),
- ]
+ args = (DAVSchema, 'provideInterface', for_, interface) )
+