[Zope-Checkins] SVN: Zope/trunk/ - migrated some z2 interfaces to z3 interfaces, using Interface.bridge for backwards compatibility

Yvo Schubbe y.2005- at wcm-solutions.de
Wed Jul 13 06:56:36 EDT 2005


Log message for revision 33294:
  - migrated some z2 interfaces to z3 interfaces, using Interface.bridge for backwards compatibility
  - added some implements() declarations

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/OFS/Application.py
  U   Zope/trunk/lib/python/OFS/CopySupport.py
  UU  Zope/trunk/lib/python/OFS/FTPInterface.py
  UU  Zope/trunk/lib/python/OFS/FindSupport.py
  UU  Zope/trunk/lib/python/OFS/Folder.py
  UU  Zope/trunk/lib/python/OFS/IOrderSupport.py
  U   Zope/trunk/lib/python/OFS/ObjectManager.py
  UU  Zope/trunk/lib/python/OFS/OrderSupport.py
  UU  Zope/trunk/lib/python/OFS/OrderedFolder.py
  U   Zope/trunk/lib/python/OFS/PropertyManager.py
  U   Zope/trunk/lib/python/OFS/SimpleItem.py
  U   Zope/trunk/lib/python/OFS/Traversable.py
  U   Zope/trunk/lib/python/OFS/interfaces.py
  U   Zope/trunk/lib/python/OFS/tests/testApplication.py
  U   Zope/trunk/lib/python/OFS/tests/testCopySupport.py
  U   Zope/trunk/lib/python/OFS/tests/testFTPInterface.py
  U   Zope/trunk/lib/python/OFS/tests/testFindSupport.py
  U   Zope/trunk/lib/python/OFS/tests/testFolder.py
  U   Zope/trunk/lib/python/OFS/tests/testObjectManager.py
  U   Zope/trunk/lib/python/OFS/tests/testOrderSupport.py
  U   Zope/trunk/lib/python/OFS/tests/testOrderedFolder.py
  U   Zope/trunk/lib/python/OFS/tests/testProperties.py
  U   Zope/trunk/lib/python/OFS/tests/testSimpleItem.py
  U   Zope/trunk/lib/python/OFS/tests/testTraverse.py
  UU  Zope/trunk/lib/python/Products/PluginIndexes/common/PluggableIndex.py
  U   Zope/trunk/lib/python/Products/PluginIndexes/interfaces.py
  UU  Zope/trunk/lib/python/Products/ZCatalog/IZCatalog.py
  U   Zope/trunk/lib/python/Products/ZCatalog/interfaces.py
  U   Zope/trunk/lib/python/webdav/Collection.py
  UU  Zope/trunk/lib/python/webdav/Resource.py
  U   Zope/trunk/lib/python/webdav/WriteLockInterface.py
  U   Zope/trunk/lib/python/webdav/interfaces.py
  U   Zope/trunk/lib/python/webdav/tests/testCollection.py
  U   Zope/trunk/lib/python/webdav/tests/testNullResource.py
  U   Zope/trunk/lib/python/webdav/tests/testResource.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/doc/CHANGES.txt	2005-07-13 10:56:36 UTC (rev 33294)
@@ -26,6 +26,10 @@
 
     Features added
 
+      - AccessControl, Acquisition, App, OFS, webdav, PluginIndexes, ZCatalog
+        and ZCTextIndex: Added some Zope 3 style interfaces.
+        This makes the bridged interfaces shipped with Five obsolete.
+
       - Interface: Added Z3 -> Z2 bridge utilities.
         This allows to migrate interfaces to Zope 3 style interfaces and
         bridge them back to oldstyle interfaces for backwards compatibility.

Modified: Zope/trunk/lib/python/OFS/Application.py
===================================================================
--- Zope/trunk/lib/python/OFS/Application.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/Application.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -7,7 +7,7 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
 """Application support
@@ -19,7 +19,7 @@
 from cgi import escape
 from StringIO import StringIO
 
-import Globals, Products, App.Product, App.ProductRegistry, misc_
+import Globals, Products, App.Product, App.ProductRegistry
 import transaction
 from AccessControl.User import UserFolder
 from Acquisition import aq_base
@@ -29,21 +29,27 @@
 from App.ProductContext import ProductContext
 from DateTime import DateTime
 from HelpSys.HelpSys import HelpSys
-from misc_ import Misc_
 from webdav.NullResource import NullResource
 from zExceptions import Redirect as RedirectException, Forbidden
 from zLOG import LOG, ERROR, WARNING, INFO
+from zope.interface import implements
 
 import Folder
+import misc_
 import ZDOM
 from FindSupport import FindSupport
+from interfaces import IApplication
+from misc_ import Misc_
 
+
 class Application(Globals.ApplicationDefaultPermissions,
                   ZDOM.Root, Folder.Folder,
                   App.ProductRegistry.ProductRegistry, FindSupport):
 
     """Top-level system object"""
 
+    implements(IApplication)
+
     title ='Zope'
     #__roles__=['Manager', 'Anonymous']
     __defined_roles__=('Manager','Anonymous','Owner')
@@ -401,7 +407,7 @@
             default_period_secs = 20
             default_timeout_mins = 20
 
-            limit = getattr(config, 'maximum_number_of_session_objects', 
+            limit = getattr(config, 'maximum_number_of_session_objects',
                             default_limit)
             timeout_spec = getattr(config, 'session_timeout_minutes',
                                    default_timeout_mins)

Modified: Zope/trunk/lib/python/OFS/CopySupport.py
===================================================================
--- Zope/trunk/lib/python/OFS/CopySupport.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/CopySupport.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -7,7 +7,7 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
 """Copy interface
@@ -23,14 +23,18 @@
 
 import Globals, Moniker, ExtensionClass
 import transaction
-from App.Dialogs import MessageDialog
 from AccessControl import getSecurityManager
 from AccessControl.Permissions import delete_objects as DeleteObjects
 from Acquisition import aq_base, aq_inner, aq_parent
+from App.Dialogs import MessageDialog
+from webdav.Lockable import ResourceLockedError
 from zExceptions import Unauthorized, BadRequest
-from webdav.Lockable import ResourceLockedError
+from zope.interface import implements
 
+from OFS.interfaces import ICopyContainer
+from OFS.interfaces import ICopySource
 
+
 CopyError='Copy Error'
 
 copy_re = re.compile('^copy([0-9]*)_of_(.*)')
@@ -42,6 +46,8 @@
 
     """Interface for containerish objects which allow cut/copy/paste"""
 
+    implements(ICopyContainer)
+
     __ac_permissions__=(
         ('View management screens',
          ('manage_copyObjects', 'manage_pasteObjects',
@@ -50,7 +56,6 @@
          ('manage_cutObjects',)),
         )
 
-
     # The following three methods should be overridden to store sub-objects
     # as non-attributes.
     def _setOb(self, id, object):
@@ -240,7 +245,6 @@
                                         cb_dataValid=0)
         return result
 
-
     manage_renameForm=Globals.DTMLFile('dtml/renameForm', globals())
 
     def manage_renameObjects(self, ids=[], new_ids=[], REQUEST=None):
@@ -430,11 +434,12 @@
 Globals.default__class_init__(CopyContainer)
 
 
-
 class CopySource(ExtensionClass.Base):
 
     """Interface for objects which allow themselves to be copied."""
 
+    implements(ICopySource)
+
     # declare a dummy permission for Copy or Move here that we check
     # in cb_isCopyable.
     __ac_permissions__=(

Modified: Zope/trunk/lib/python/OFS/FTPInterface.py
===================================================================
--- Zope/trunk/lib/python/OFS/FTPInterface.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/FTPInterface.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -7,10 +7,9 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-
 """FTP Support for Zope classes.
 
 Preliminary FTP support interface. Note, most FTP functions are
@@ -19,11 +18,20 @@
 All FTP methods should be governed by a single permission:
 'FTP access'.
 
+$Id$
 """
 
+from zope.interface import implements
+
+from interfaces import IFTPAccess
+
+
 class FTPInterface:
+
     "Interface for FTP objects"
 
+    implements(IFTPAccess)
+
     # XXX The stat and list marshal format should probably
     #     be XML, not marshal, maybe Andrew K's xml-marshal.
     #     This will probably be changed later.


Property changes on: Zope/trunk/lib/python/OFS/FTPInterface.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.4
Name: svn:keywords
   + Id

Modified: Zope/trunk/lib/python/OFS/FindSupport.py
===================================================================
--- Zope/trunk/lib/python/OFS/FindSupport.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/FindSupport.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -7,26 +7,35 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
 """Find support
 
 $Id$
 """
-import sys, os, time, Globals, ExtensionClass
+
+from string import translate
+
+import Globals, ExtensionClass
+from AccessControl import ClassSecurityInfo
+from AccessControl.DTML import RestrictedDTML
+from AccessControl.Permission import name_trans
+from DateTime import DateTime
 from DocumentTemplate.DT_Util import Eval
-from AccessControl.Permission import name_trans
+from DocumentTemplate.DT_Util import InstanceDict, TemplateDict
 from Globals import DTMLFile
-from DocumentTemplate.DT_Util import InstanceDict, TemplateDict
-from DateTime import DateTime
-from string import translate
-from AccessControl.DTML import RestrictedDTML
-from AccessControl import ClassSecurityInfo
+from zope.interface import implements
 
+from interfaces import IFindSupport
+
+
 class FindSupport(ExtensionClass.Base):
+
     """Find support for Zope Folders"""
 
+    implements(IFindSupport)
+
 #findframe is deprecated
     manage_findFrame=DTMLFile('dtml/findFrame', globals())
     manage_findForm=DTMLFile('dtml/findForm', globals(),
@@ -250,9 +259,9 @@
 
         return result
 
+Globals.InitializeClass(FindSupport)
 
 
-
 class td(RestrictedDTML, TemplateDict):
     pass
 
@@ -304,8 +313,6 @@
     return 1
 
 
-Globals.InitializeClass(FindSupport)
-
 # Helper functions
 
 def absattr(attr):


Property changes on: Zope/trunk/lib/python/OFS/FindSupport.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.33

Modified: Zope/trunk/lib/python/OFS/Folder.py
===================================================================
--- Zope/trunk/lib/python/OFS/Folder.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/Folder.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -7,7 +7,7 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
 """Folder object
@@ -16,16 +16,22 @@
 
 $Id$
 """
-import Globals, SimpleItem, ObjectManager, PropertyManager
-import AccessControl.Role, webdav.Collection, FindSupport
-from webdav.WriteLockInterface import WriteLockInterface
+
+import AccessControl.Role, webdav.Collection
+import Globals
 from AccessControl import getSecurityManager
 from AccessControl import Unauthorized
 from AccessControl.Permissions import add_page_templates
 from AccessControl.Permissions import add_user_folders
 from Globals import DTMLFile
+from webdav.WriteLockInterface import WriteLockInterface
+from zope.interface import implements
 
+import FindSupport
+import SimpleItem, ObjectManager, PropertyManager
+from interfaces import IFolder
 
+
 manage_addFolderForm=DTMLFile('dtml/folderAdd', globals())
 
 def manage_addFolder(self, id, title='',
@@ -72,12 +78,14 @@
     SimpleItem.Item,
     FindSupport.FindSupport,
     ):
-    """
-    Folders are basic container objects that provide a standard
+
+    """Folders are basic container objects that provide a standard
     interface for object management. Folder objects also implement
     a management interface and can have arbitrary properties.
     """
+
     __implements__ = (WriteLockInterface,)
+    implements(IFolder)
     meta_type='Folder'
 
     _properties=({'id':'title', 'type': 'string','mode':'wd'},)


Property changes on: Zope/trunk/lib/python/OFS/Folder.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.104

Modified: Zope/trunk/lib/python/OFS/IOrderSupport.py
===================================================================
--- Zope/trunk/lib/python/OFS/IOrderSupport.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/IOrderSupport.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -7,7 +7,7 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
 """ Order support interfaces.
@@ -15,100 +15,14 @@
 $Id$
 """
 
-from Interface import Interface
 
+# create IOrderedContainer
+from Interface.bridge import createZope3Bridge
+from OFS.interfaces import IOrderedContainer as z3IOrderedContainer
+import IOrderSupport
 
-class IOrderedContainer(Interface):
-    """ Ordered Container interface.
+createZope3Bridge(z3IOrderedContainer, IOrderSupport, 'IOrderedContainer')
 
-    This interface provides a common mechanism for maintaining ordered
-    collections.
-    """
-
-    def moveObjectsByDelta(ids, delta, subset_ids=None):
-        """ Move specified sub-objects by delta.
-
-        If delta is higher than the possible maximum, objects will be moved to
-        the bottom. If delta is lower than the possible minimum, objects will
-        be moved to the top.
-
-        If subset_ids is not None, delta will be interpreted relative to the
-        subset specified by a sequence of ids. The position of objects that
-        are not part of this subset will not be changed.
-
-        The order of the objects specified by ids will always be preserved. So
-        if you don't want to change their original order, make sure the order
-        of ids corresponds to their original order.
-
-        If an object with id doesn't exist an error will be raised.
-
-        Permission -- Manage properties
-
-        Returns -- Number of moved sub-objects
-        """
-
-    def moveObjectsUp(ids, delta=1, subset_ids=None):
-        """ Move specified sub-objects up by delta in container.
-
-        If no delta is specified, delta is 1. See moveObjectsByDelta for more
-        details.
-
-        Permission -- Manage properties
-
-        Returns -- Number of moved sub-objects
-        """
-
-    def moveObjectsDown(ids, delta=1, subset_ids=None):
-        """ Move specified sub-objects down by delta in container.
-
-        If no delta is specified, delta is 1. See moveObjectsByDelta for more
-        details.
-
-        Permission -- Manage properties
-
-        Returns -- Number of moved sub-objects
-        """
-
-    def moveObjectsToTop(ids, subset_ids=None):
-        """ Move specified sub-objects to top of container.
-
-        See moveObjectsByDelta for more details.
-
-        Permission -- Manage properties
-
-        Returns -- Number of moved sub-objects
-        """
-
-    def moveObjectsToBottom(ids, subset_ids=None):
-        """ Move specified sub-objects to bottom of container.
-
-        See moveObjectsByDelta for more details.
-
-        Permission -- Manage properties
-
-        Returns -- Number of moved sub-objects
-        """
-
-    def orderObjects(key, reverse=None):
-        """ Order sub-objects by key and direction.
-
-        Permission -- Manage properties
-
-        Returns -- Number of moved sub-objects
-        """
-
-    def getObjectPosition(id):
-        """ Get the position of an object by its id.
-
-        Permission -- Access contents information
-
-        Returns -- Position
-        """
-
-    def moveObjectToPosition(id, position):
-        """ Move specified object to absolute position.
-
-        Permission -- Manage properties
-
-        Returns -- Number of moved sub-objects
-        """
+del createZope3Bridge
+del z3IOrderedContainer
+del IOrderSupport


Property changes on: Zope/trunk/lib/python/OFS/IOrderSupport.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.4

Modified: Zope/trunk/lib/python/OFS/ObjectManager.py
===================================================================
--- Zope/trunk/lib/python/OFS/ObjectManager.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/ObjectManager.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -7,7 +7,7 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
 """Object Manager
@@ -15,32 +15,35 @@
 $Id$
 """
 
+import marshal
 import sys, fnmatch, copy, os, re
-import marshal
 from cgi import escape
 from cStringIO import StringIO
 from types import StringType, UnicodeType
 
+import App.Common
+import App.FactoryDispatcher, Products
 import App.Management, Acquisition, Globals, Products
-import App.FactoryDispatcher, Products
+from AccessControl import getSecurityManager
+from AccessControl.ZopeSecurityPolicy import getRoles
+from Acquisition import aq_base
+from App.config import getConfiguration
 from Globals import DTMLFile, Persistent
 from Globals import MessageDialog, default__class_init__
 from Globals import REPLACEABLE, NOT_REPLACEABLE, UNIQUE
-from webdav.NullResource import NullResource
 from webdav.Collection import Collection
-from Acquisition import aq_base
 from webdav.Lockable import ResourceLockedError
+from webdav.NullResource import NullResource
+from zExceptions import BadRequest
+from zLOG import LOG, ERROR
 from ZODB.POSException import ConflictError
-import App.Common
-from App.config import getConfiguration
-from AccessControl import getSecurityManager
-from AccessControl.ZopeSecurityPolicy import getRoles
-from zLOG import LOG, ERROR
-from zExceptions import BadRequest
+from zope.interface import implements
 
-from OFS.Traversable import Traversable
 import CopySupport
+from interfaces import IObjectManager
+from Traversable import Traversable
 
+
 # the name BadRequestException is relied upon by 3rd-party code
 BadRequestException = BadRequest
 
@@ -122,6 +125,8 @@
     This class provides core behavior for collections of heterogeneous objects.
     """
 
+    implements(IObjectManager)
+
     __ac_permissions__=(
         ('View management screens', ('manage_main',)),
         ('Access contents information',
@@ -595,7 +600,7 @@
             paths.append(cfg.instancehome)
         for impath in paths:
             directory = os.path.join(impath, 'import')
-            listing += [f for f in os.listdir(directory) 
+            listing += [f for f in os.listdir(directory)
                         if f.endswith('.zexp') or f.endswith('.xml')]
         return listing
 

Modified: Zope/trunk/lib/python/OFS/OrderSupport.py
===================================================================
--- Zope/trunk/lib/python/OFS/OrderSupport.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/OrderSupport.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -7,7 +7,7 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
 """ Order support for 'Object Manager'.
@@ -23,12 +23,15 @@
 from Acquisition import aq_base
 from DocumentTemplate.sequence import sort
 from Globals import InitializeClass
+from zope.interface import implements
 
-from IOrderSupport import IOrderedContainer
+from interfaces import IOrderedContainer as z3IOrderedContainer
+from IOrderSupport import IOrderedContainer as z2IOrderedContainer
 from ObjectManager import ObjectManager
 
 
 class OrderSupport:
+
     """ Ordered container mixin class.
 
     This is an extension to the regular ObjectManager. It saves the objects in
@@ -37,7 +40,8 @@
     is totally user-specific.
     """
 
-    __implements__ = IOrderedContainer
+    __implements__ = z2IOrderedContainer
+    implements(z3IOrderedContainer)
     security = ClassSecurityInfo()
 
     has_order_support = 1


Property changes on: Zope/trunk/lib/python/OFS/OrderSupport.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.6

Modified: Zope/trunk/lib/python/OFS/OrderedFolder.py
===================================================================
--- Zope/trunk/lib/python/OFS/OrderedFolder.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/OrderedFolder.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -7,7 +7,7 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
 """ 'Folder' with order support.
@@ -20,8 +20,10 @@
 from AccessControl.Permissions import add_page_templates
 from AccessControl.Permissions import add_user_folders
 from Globals import DTMLFile
+from zope.interface import implements
 
 from Folder import Folder
+from interfaces import IOrderedFolder
 from OrderSupport import OrderSupport
 
 manage_addOrderedFolderForm = DTMLFile('dtml/addOrderedFolder', globals())
@@ -61,10 +63,13 @@
 
 
 class OrderedFolder(OrderSupport, Folder):
+
     """ Extends the default Folder by order support.
     """
+
     __implements__ = (OrderSupport.__implements__,
                       Folder.__implements__)
+    implements(IOrderedFolder)
     meta_type='Folder (Ordered)'
 
     manage_options = ( OrderSupport.manage_options +


Property changes on: Zope/trunk/lib/python/OFS/OrderedFolder.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.2

Modified: Zope/trunk/lib/python/OFS/PropertyManager.py
===================================================================
--- Zope/trunk/lib/python/OFS/PropertyManager.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/PropertyManager.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -7,7 +7,7 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
 """Property management
@@ -19,13 +19,15 @@
 from types import ListType
 
 import ExtensionClass, Globals
-from ZPublisher.Converters import type_converters
+from Acquisition import aq_base
 from Globals import DTMLFile, MessageDialog
-from Acquisition import aq_base
 from Globals import Persistent
 from zExceptions import BadRequest
+from zope.interface import implements
+from ZPublisher.Converters import type_converters
 
 import ZDOM
+from interfaces import IPropertyManager
 from PropertySheets import DefaultPropertySheets, vps
 
 
@@ -93,6 +95,8 @@
                              'manage_changeProperties',)),
     """
 
+    implements(IPropertyManager)
+
     manage_options=(
         {'label':'Properties', 'action':'manage_propertiesForm',
          'help':('OFSP','Properties.stx')},

Modified: Zope/trunk/lib/python/OFS/SimpleItem.py
===================================================================
--- Zope/trunk/lib/python/OFS/SimpleItem.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/SimpleItem.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -7,7 +7,7 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
 """This module implements a simple item mix-in for objects that have a
@@ -22,22 +22,27 @@
 
 import marshal, re, sys, time
 
+import AccessControl.Role, AccessControl.Owned, App.Common
 import Globals, App.Management, Acquisition, App.Undo
-import AccessControl.Role, AccessControl.Owned, App.Common
-from webdav.Resource import Resource
-from ExtensionClass import Base
-from ComputedAttribute import ComputedAttribute
 from AccessControl import getSecurityManager, Unauthorized
 from AccessControl.ZopeSecurityPolicy import getRoles
 from Acquisition import aq_base, aq_parent, aq_inner, aq_acquire
+from ComputedAttribute import ComputedAttribute
 from DocumentTemplate.ustr import ustr
+from ExtensionClass import Base
+from webdav.Resource import Resource
+from zExceptions import Redirect
 from zExceptions.ExceptionFormatter import format_exception
-from zExceptions import Redirect
 from zLOG import LOG, BLATHER
+from zope.interface import implements
 
+import ZDOM
 from CopySupport import CopySource
+from interfaces import IItem
+from interfaces import IItemWithName
+from interfaces import IManageable
+from interfaces import ISimpleItem
 from Traversable import Traversable
-import ZDOM
 
 HTML=Globals.HTML
 
@@ -50,6 +55,8 @@
 
     """A common base class for simple, non-container objects."""
 
+    implements(IItem, IManageable)
+
     isPrincipiaFolderish=0
     isTopLevelPrincipiaApplicationObject=0
 
@@ -216,7 +223,7 @@
                 try:
                     strv = str(error_value)
                 except:
-                    strv = ('<unprintable %s object>' % 
+                    strv = ('<unprintable %s object>' %
                             str(type(error_value).__name__))
                 v = strv + (
                     " (Also, an error occurred while attempting "
@@ -342,8 +349,11 @@
 
 
 class Item_w__name__(Item):
+
     """Mixin class to support common name/id functions"""
 
+    implements(IItemWithName)
+
     def getId(self):
         """Return the id of the object as a string.
         """
@@ -397,6 +407,8 @@
     """Mix-in class combining the most common set of basic mix-ins
     """
 
+    implements(ISimpleItem)
+
     manage_options=Item.manage_options+(
         {'label':'Security',
          'action':'manage_access',

Modified: Zope/trunk/lib/python/OFS/Traversable.py
===================================================================
--- Zope/trunk/lib/python/OFS/Traversable.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/Traversable.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -7,7 +7,7 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
 """This module implements a mix-in for traversable objects.
@@ -17,18 +17,23 @@
 
 from urllib import quote
 
-from Acquisition import Acquired, aq_inner, aq_parent, aq_base
 from AccessControl import getSecurityManager
 from AccessControl import Unauthorized
 from AccessControl.ZopeGuards import guarded_getattr
+from Acquisition import Acquired, aq_inner, aq_parent, aq_base
+from zExceptions import NotFound
 from ZODB.POSException import ConflictError
-from zExceptions import NotFound
+from zope.interface import implements
 
+from interfaces import ITraversable
+
 _marker = object()
 
 
 class Traversable:
 
+    implements(ITraversable)
+
     absolute_url__roles__=None # Public
     def absolute_url(self, relative=0):
         """Return the absolute URL of the object.
@@ -134,7 +139,7 @@
         if isinstance(path, str):
             # Unicode paths are not allowed
             path = path.split('/')
-        else: 
+        else:
             path = list(path)
 
         REQUEST = {'TraversalRequestNameStack': path}
@@ -145,16 +150,16 @@
             # Remove trailing slash
             path.pop(0)
 
-        if restricted: 
+        if restricted:
             securityManager = getSecurityManager()
-        else: 
+        else:
             securityManager = _none
 
         if not path[-1]:
             # If the path starts with an empty string, go to the root first.
             path_pop()
             self = self.getPhysicalRoot()
-            if (restricted 
+            if (restricted
                 and not securityManager.validate(None, None, None, self)):
                 raise Unauthorized, name
 

Modified: Zope/trunk/lib/python/OFS/interfaces.py
===================================================================
--- Zope/trunk/lib/python/OFS/interfaces.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/interfaces.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -29,18 +29,103 @@
 from webdav.interfaces import IDAVResource
 
 
-# create IOrderedContainer
-from Products.Five.fiveconfigure import createZope2Bridge
-from OFS.IOrderSupport import IOrderedContainer as z2IOrderedContainer
-import interfaces
+class IOrderedContainer(Interface):
 
-createZope2Bridge(z2IOrderedContainer, interfaces, 'IOrderedContainer')
+    """ Ordered Container interface.
 
-del createZope2Bridge
-del z2IOrderedContainer
-del interfaces
+    This interface provides a common mechanism for maintaining ordered
+    collections.
+    """
 
+    def moveObjectsByDelta(ids, delta, subset_ids=None):
+        """ Move specified sub-objects by delta.
 
+        If delta is higher than the possible maximum, objects will be moved to
+        the bottom. If delta is lower than the possible minimum, objects will
+        be moved to the top.
+
+        If subset_ids is not None, delta will be interpreted relative to the
+        subset specified by a sequence of ids. The position of objects that
+        are not part of this subset will not be changed.
+
+        The order of the objects specified by ids will always be preserved. So
+        if you don't want to change their original order, make sure the order
+        of ids corresponds to their original order.
+
+        If an object with id doesn't exist an error will be raised.
+
+        Permission -- Manage properties
+
+        Returns -- Number of moved sub-objects
+        """
+
+    def moveObjectsUp(ids, delta=1, subset_ids=None):
+        """ Move specified sub-objects up by delta in container.
+
+        If no delta is specified, delta is 1. See moveObjectsByDelta for more
+        details.
+
+        Permission -- Manage properties
+
+        Returns -- Number of moved sub-objects
+        """
+
+    def moveObjectsDown(ids, delta=1, subset_ids=None):
+        """ Move specified sub-objects down by delta in container.
+
+        If no delta is specified, delta is 1. See moveObjectsByDelta for more
+        details.
+
+        Permission -- Manage properties
+
+        Returns -- Number of moved sub-objects
+        """
+
+    def moveObjectsToTop(ids, subset_ids=None):
+        """ Move specified sub-objects to top of container.
+
+        See moveObjectsByDelta for more details.
+
+        Permission -- Manage properties
+
+        Returns -- Number of moved sub-objects
+        """
+
+    def moveObjectsToBottom(ids, subset_ids=None):
+        """ Move specified sub-objects to bottom of container.
+
+        See moveObjectsByDelta for more details.
+
+        Permission -- Manage properties
+
+        Returns -- Number of moved sub-objects
+        """
+
+    def orderObjects(key, reverse=None):
+        """ Order sub-objects by key and direction.
+
+        Permission -- Manage properties
+
+        Returns -- Number of moved sub-objects
+        """
+
+    def getObjectPosition(id):
+        """ Get the position of an object by its id.
+
+        Permission -- Access contents information
+
+        Returns -- Position
+        """
+
+    def moveObjectToPosition(id, position):
+        """ Move specified object to absolute position.
+
+        Permission -- Manage properties
+
+        Returns -- Number of moved sub-objects
+        """
+
+
 # XXX: might contain non-API methods and outdated comments;
 #      not synced with ZopeBook API Reference;
 #      based on OFS.CopySupport.CopySource
@@ -738,7 +823,8 @@
 
     """Folders are basic container objects that provide a standard
     interface for object management. Folder objects also implement a
-    management interface and can have arbitrary properties."""
+    management interface and can have arbitrary properties.
+    """
 
 
 # XXX: based on OFS.OrderedFolder.OrderedFolder

Modified: Zope/trunk/lib/python/OFS/tests/testApplication.py
===================================================================
--- Zope/trunk/lib/python/OFS/tests/testApplication.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/tests/testApplication.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -8,7 +8,7 @@
         from OFS.Application import Application
         from zope.interface.verify import verifyClass
 
-        verifyClass(IApplication, Application, 1)
+        verifyClass(IApplication, Application)
 
 
 def test_suite():

Modified: Zope/trunk/lib/python/OFS/tests/testCopySupport.py
===================================================================
--- Zope/trunk/lib/python/OFS/tests/testCopySupport.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/tests/testCopySupport.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -4,20 +4,17 @@
 Zope2.startup()
 
 import cStringIO
-from mimetools import Message
-from multifile import MultiFile
 
 import transaction
 from AccessControl import SecurityManager
 from AccessControl.SecurityManagement import newSecurityManager
 from AccessControl.SecurityManagement import noSecurityManager
-from Acquisition import Implicit
 from Acquisition import aq_base
+from Acquisition import Implicit
 from OFS.Application import Application
 from OFS.Folder import manage_addFolder
 from OFS.Image import manage_addFile
 from Testing.makerequest import makerequest
-from webdav.common import rfc1123_date
 
 
 ADD_IMAGES_AND_FILES = 'Add images and files'
@@ -142,8 +139,8 @@
         from OFS.interfaces import ICopySource
         from zope.interface.verify import verifyClass
 
-        verifyClass(ICopyContainer, CopyContainer, 1)
-        verifyClass(ICopySource, CopySource, 1)
+        verifyClass(ICopyContainer, CopyContainer)
+        verifyClass(ICopySource, CopySource)
 
     def testRename( self ):
         self.failUnless( 'file' in self.folder1.objectIds() )
@@ -348,7 +345,7 @@
         except CopyError, e:
 
             if ce_regex is not None:
-                
+
                 pattern = re.compile( ce_regex, re.DOTALL )
                 if pattern.search( e ) is None:
                     self.fail( "Paste failed; didn't match pattern:\n%s" % e )
@@ -362,7 +359,7 @@
         else:
             self.fail( "Paste allowed unexpectedly." )
 
-    def _initPolicyAndUser( self    
+    def _initPolicyAndUser( self
                           , a_lambda=None
                           , v_lambda=None
                           , c_lambda=None
@@ -420,7 +417,7 @@
                                    )
 
     def test_copy_cant_create_target_metatype_not_supported( self ):
-        
+
         from OFS.CopySupport import CopyError
 
         folder1, folder2 = self._initFolders()
@@ -451,7 +448,7 @@
         self.failUnless( 'file' in folder2.objectIds() )
 
     def test_move_cant_read_source( self ):
-        
+
         from OFS.CopySupport import CopyError
 
         folder1, folder2 = self._initFolders()
@@ -471,7 +468,7 @@
                                    )
 
     def test_move_cant_create_target_metatype_not_supported( self ):
-        
+
         from OFS.CopySupport import CopyError
 
         folder1, folder2 = self._initFolders()
@@ -486,7 +483,7 @@
                                    )
 
     def test_move_cant_create_target_metatype_not_allowed( self ):
-        
+
         from OFS.CopySupport import CopyError
 
         folder1, folder2 = self._initFolders()
@@ -505,7 +502,7 @@
                                    )
 
     def test_move_cant_delete_source( self ):
-        
+
         from OFS.CopySupport import CopyError
         from AccessControl.Permissions import delete_objects as DeleteObjects
 

Modified: Zope/trunk/lib/python/OFS/tests/testFTPInterface.py
===================================================================
--- Zope/trunk/lib/python/OFS/tests/testFTPInterface.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/tests/testFTPInterface.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -8,7 +8,7 @@
         from OFS.FTPInterface import FTPInterface
         from zope.interface.verify import verifyClass
 
-        verifyClass(IFTPAccess, FTPInterface, 1)
+        verifyClass(IFTPAccess, FTPInterface)
 
 
 def test_suite():

Modified: Zope/trunk/lib/python/OFS/tests/testFindSupport.py
===================================================================
--- Zope/trunk/lib/python/OFS/tests/testFindSupport.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/tests/testFindSupport.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -8,7 +8,7 @@
         from OFS.FindSupport import FindSupport
         from zope.interface.verify import verifyClass
 
-        verifyClass(IFindSupport, FindSupport, 1)
+        verifyClass(IFindSupport, FindSupport)
 
 
 def test_suite():

Modified: Zope/trunk/lib/python/OFS/tests/testFolder.py
===================================================================
--- Zope/trunk/lib/python/OFS/tests/testFolder.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/tests/testFolder.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -16,8 +16,8 @@
         from webdav.interfaces import IWriteLock
         from zope.interface.verify import verifyClass
 
-        verifyClass(IFolder, Folder, 1)
-        verifyClass(IWriteLock, Folder, 1)
+        verifyClass(IFolder, Folder)
+        verifyClass(IWriteLock, Folder)
 
 
 def test_suite():

Modified: Zope/trunk/lib/python/OFS/tests/testObjectManager.py
===================================================================
--- Zope/trunk/lib/python/OFS/tests/testObjectManager.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/tests/testObjectManager.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -1,15 +1,16 @@
 import unittest
 
-from App.config import getConfiguration
-from Acquisition import Implicit, aq_base, aq_parent
+from AccessControl.Owned import EmergencyUserCannotOwn
 from AccessControl.SecurityManagement import newSecurityManager
 from AccessControl.SecurityManagement import noSecurityManager
+from AccessControl.SpecialUsers import emergency_user, nobody, system
 from AccessControl.User import User
-from AccessControl.SpecialUsers import emergency_user, nobody, system
-from AccessControl.Owned import EmergencyUserCannotOwn, Owned
+from Acquisition import Implicit
+from App.config import getConfiguration
 from OFS.ObjectManager import ObjectManager
 from OFS.SimpleItem import SimpleItem
 
+
 class FauxRoot( Implicit ):
 
     id = '/'
@@ -75,7 +76,7 @@
         from OFS.ObjectManager import ObjectManager
         from zope.interface.verify import verifyClass
 
-        verifyClass(IObjectManager, ObjectManager, 1)
+        verifyClass(IObjectManager, ObjectManager)
 
     def test_setObject_set_owner_with_no_user( self ):
 
@@ -310,6 +311,7 @@
         om2._setObject(ob.getId(), ob)
         self.assertRaises(DeleteFailed, om1._delObject, 'om2')
 
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest( unittest.makeSuite( ObjectManagerTests ) )

Modified: Zope/trunk/lib/python/OFS/tests/testOrderSupport.py
===================================================================
--- Zope/trunk/lib/python/OFS/tests/testOrderSupport.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/tests/testOrderSupport.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -1,7 +1,4 @@
 import unittest
-import Testing
-import Zope2
-Zope2.startup()
 
 from OFS.CopySupport import CopySource
 from OFS.ObjectManager import ObjectManager
@@ -55,7 +52,7 @@
         from OFS.OrderSupport import OrderSupport
         from zope.interface.verify import verifyClass
 
-        verifyClass(IOrderedContainer, OrderSupport, 1)
+        verifyClass(IOrderedContainer, OrderSupport)
 
     def _doCanonTest(self, methodname, table):
         for args, order, rval in table:

Modified: Zope/trunk/lib/python/OFS/tests/testOrderedFolder.py
===================================================================
--- Zope/trunk/lib/python/OFS/tests/testOrderedFolder.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/tests/testOrderedFolder.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -19,9 +19,9 @@
         from webdav.interfaces import IWriteLock
         from zope.interface.verify import verifyClass
 
-        verifyClass(IOrderedContainer, OrderedFolder, 1)
-        verifyClass(IOrderedFolder, OrderedFolder, 1)
-        verifyClass(IWriteLock, OrderedFolder, 1)
+        verifyClass(IOrderedContainer, OrderedFolder)
+        verifyClass(IOrderedFolder, OrderedFolder)
+        verifyClass(IWriteLock, OrderedFolder)
 
 
 def test_suite():

Modified: Zope/trunk/lib/python/OFS/tests/testProperties.py
===================================================================
--- Zope/trunk/lib/python/OFS/tests/testProperties.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/tests/testProperties.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -1,7 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
+# Copyright (c) 2001 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.
@@ -11,7 +10,11 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
+"""Properties unit tests.
 
+$Id$
+"""
+
 import unittest
 
 
@@ -28,7 +31,7 @@
         from OFS.PropertyManager import PropertyManager
         from zope.interface.verify import verifyClass
 
-        verifyClass(IPropertyManager, PropertyManager, 1)
+        verifyClass(IPropertyManager, PropertyManager)
 
     def testLinesPropertyIsTuple( self ):
         inst = self._makeOne()

Modified: Zope/trunk/lib/python/OFS/tests/testSimpleItem.py
===================================================================
--- Zope/trunk/lib/python/OFS/tests/testSimpleItem.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/tests/testSimpleItem.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -9,8 +9,8 @@
         from OFS.SimpleItem import Item
         from zope.interface.verify import verifyClass
 
-        verifyClass(IItem, Item, 1)
-        verifyClass(IManageable, Item, 1)
+        verifyClass(IItem, Item)
+        verifyClass(IManageable, Item)
 
 
 class TestItem_w__name__(unittest.TestCase):
@@ -20,7 +20,7 @@
         from OFS.SimpleItem import Item_w__name__
         from zope.interface.verify import verifyClass
 
-        verifyClass(IItemWithName, Item_w__name__, 1)
+        verifyClass(IItemWithName, Item_w__name__)
 
 
 class TestSimpleItem(unittest.TestCase):
@@ -30,7 +30,7 @@
         from OFS.SimpleItem import SimpleItem
         from zope.interface.verify import verifyClass
 
-        verifyClass(ISimpleItem, SimpleItem, 1)
+        verifyClass(ISimpleItem, SimpleItem)
 
 
 def test_suite():

Modified: Zope/trunk/lib/python/OFS/tests/testTraverse.py
===================================================================
--- Zope/trunk/lib/python/OFS/tests/testTraverse.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/OFS/tests/testTraverse.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -1,7 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
+# Copyright (c) 2001 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.
@@ -11,26 +10,28 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
+"""Traverse unit tests.
 
-import os, sys, unittest
-import string, cStringIO, re
+$Id$
+"""
 
+import unittest
+
+import cStringIO
+
+import transaction
 import ZODB, Acquisition, transaction
-import transaction
+from AccessControl import SecurityManager, Unauthorized
+from AccessControl.SecurityManagement import newSecurityManager
+from AccessControl.SecurityManagement import noSecurityManager
 from Acquisition import aq_base
 from OFS.Application import Application
 from OFS.Folder import manage_addFolder
 from OFS.Image import manage_addFile
 from OFS.SimpleItem import SimpleItem
 from Testing.makerequest import makerequest
-from AccessControl import SecurityManager, Unauthorized
-from AccessControl.SecurityManagement import newSecurityManager
-from AccessControl.SecurityManagement import noSecurityManager
 
-from mimetools import Message
-from multifile import MultiFile
 
-
 class UnitTestSecurityPolicy:
     """
         Stub out the existing security policy for unit testing purposes.
@@ -93,11 +94,11 @@
             return 42
         else:
             raise KeyError
-    
+
     def bb_method(self):
         """Test Method"""
         pass
-        
+
     bb_status = 'screechy'
 
 
@@ -168,20 +169,20 @@
         from OFS.Traversable import Traversable
         from zope.interface.verify import verifyClass
 
-        verifyClass(ITraversable, Traversable, 1)
+        verifyClass(ITraversable, Traversable)
 
     def testTraversePath( self ):
         self.failUnless( 'file' in self.folder1.objectIds() )
-        self.failUnless( 
+        self.failUnless(
             self.folder1.unrestrictedTraverse( ('', 'folder1', 'file' ) ))
-        self.failUnless( 
+        self.failUnless(
             self.folder1.unrestrictedTraverse( ('', 'folder1' ) ))
 
     def testTraverseURLNoSlash( self ):
         self.failUnless( 'file' in self.folder1.objectIds() )
-        self.failUnless( 
+        self.failUnless(
             self.folder1.unrestrictedTraverse( '/folder1/file' ))
-        self.failUnless( 
+        self.failUnless(
             self.folder1.unrestrictedTraverse( '/folder1' ))
 
     def testTraverseURLSlash( self ):
@@ -190,12 +191,12 @@
         self.failUnless( self.folder1.unrestrictedTraverse( '/folder1/' ))
 
     def testTraverseToNone( self ):
-        self.failUnlessRaises( 
-            KeyError, 
+        self.failUnlessRaises(
+            KeyError,
             self.folder1.unrestrictedTraverse, ('', 'folder1', 'file2' ) )
-        self.failUnlessRaises( 
+        self.failUnlessRaises(
             KeyError, self.folder1.unrestrictedTraverse,  '/folder1/file2' )
-        self.failUnlessRaises( 
+        self.failUnlessRaises(
             KeyError, self.folder1.unrestrictedTraverse,  '/folder1/file2/' )
 
     def testBoboTraverseToWrappedSubObj(self):
@@ -245,7 +246,7 @@
         self.root.stuff = 'stuff here'
         self.failUnlessRaises(Unauthorized,
                               self.root.folder1.restrictedTraverse, 'stuff')
-    
+
     def testDefaultValueWhenUnathorized(self):
         # Test that traversing to an unauthorized object returns
         # the default when provided
@@ -255,7 +256,7 @@
         self.root.stuff = 'stuff here'
         self.assertEqual(
             self.root.folder1.restrictedTraverse('stuff', 42), 42)
-    
+
     def testDefaultValueWhenNotFound(self):
         # Test that traversing to a non-existent object returns
         # the default when provided
@@ -263,7 +264,7 @@
         SecurityManager.setSecurityPolicy( self.oldPolicy )
         self.assertEqual(
             self.root.restrictedTraverse('happy/happy', 'joy'), 'joy')
-            
+
     def testTraverseUp(self):
         # Test that we can traverse upwards
         self.failUnless(

Modified: Zope/trunk/lib/python/Products/PluginIndexes/common/PluggableIndex.py
===================================================================
--- Zope/trunk/lib/python/Products/PluginIndexes/common/PluggableIndex.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/Products/PluginIndexes/common/PluggableIndex.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -7,94 +7,28 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
+"""Pluggable Index interfaces.
 
-"""Pluggable Index Interface"""
-__version__='$Revision: 1.9 $'[11:-2]
+$Id$
+"""
 
-import Interface
 
-class PluggableIndexInterface(Interface.Base):
+# create PluggableIndexInterface, UniqueValueIndex, SortIndex
+from Interface.bridge import createZope3Bridge
+from Products.PluginIndexes.interfaces import IPluggableIndex
+from Products.PluginIndexes.interfaces import ISortIndex
+from Products.PluginIndexes.interfaces import IUniqueValueIndex
+import PluggableIndex
 
-    def getId():
-        """Return Id of index."""
+createZope3Bridge(IPluggableIndex, PluggableIndex, 'PluggableIndexInterface')
+createZope3Bridge(ISortIndex, PluggableIndex, 'SortIndex')
+createZope3Bridge(IUniqueValueIndex, PluggableIndex, 'UniqueValueIndex')
 
-    def getEntryForObject(documentId, default=None):
-        """Get all information contained for 'documentId'."""
-
-    def getIndexSourceNames():
-        """ return a sequence of attribute names that are indexed 
-            by the index. 
-        """
-
-    def index_object(documentId, obj, threshold=None):
-        """Index an object.
-
-        'documentId' is the integer ID of the document.
-        'obj' is the object to be indexed.
-        'threshold' is the number of words to process between committing
-        subtransactions.  If None, subtransactions are disabled.
-        """
-
-    def unindex_object(documentId):
-        """Remove the documentId from the index."""
-
-    def _apply_index(request, cid=''):
-        """Apply the index to query parameters given in 'request'.
-
-        The argument should be a mapping object.
-
-        If the request does not contain the needed parametrs, then
-        None is returned.
-
-        If the request contains a parameter with the name of the column
-        + "_usage", it is sniffed for information on how to handle applying
-        the index. (Note: this style or parameters is deprecated)
-
-        If the request contains a parameter with the name of the
-        column and this parameter is either a Record or a class
-        instance then it is assumed that the parameters of this index
-        are passed as attribute (Note: this is the recommended way to
-        pass parameters since Zope 2.4)
-
-        Otherwise two objects are returned.  The first object is a
-        ResultSet containing the record numbers of the matching
-        records.  The second object is a tuple containing the names of
-        all data fields used.
-        """
-    
-    def numObjects():
-        """Return the number of indexed objects"""
-
-    def indexSize():
-        """Return the size of the index in terms of distinct values"""
-    
-    def clear():
-        """Empty the index"""
-        
-class UniqueValueIndex(PluggableIndexInterface):
-    """An index which can return lists of unique values contained in it"""
-    
-    def hasUniqueValuesFor(name):
-        """Return true if the index can return the unique values for name"""
-        
-    def uniqueValues(name=None, withLengths=0):
-        """Return the unique values for name.
-
-        If 'withLengths' is true, returns a sequence of tuples of
-        (value, length)."""
-
-class SortIndex(PluggableIndexInterface):
-    """An index which may be used to sort a set of document ids"""
-    
-    def keyForDocument(documentId):
-        """Return the sort key that cooresponds to the specified document id
-        
-        This method is no longer used by ZCatalog, but is left for backwards 
-        compatibility."""
-        
-    def documentToKeyMap():
-        """Return an object that supports __getitem__ and may be used to quickly
-        lookup the sort key given a document id"""
+del createZope3Bridge
+del IPluggableIndex
+del ISortIndex
+del IUniqueValueIndex
+del PluggableIndex


Property changes on: Zope/trunk/lib/python/Products/PluginIndexes/common/PluggableIndex.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.9
Name: svn:keywords
   + Id

Modified: Zope/trunk/lib/python/Products/PluginIndexes/interfaces.py
===================================================================
--- Zope/trunk/lib/python/Products/PluginIndexes/interfaces.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/Products/PluginIndexes/interfaces.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -19,8 +19,6 @@
 from zope.schema import Bool
 
 
-# XXX: copied from common.PluggableIndex.PluggableIndexInterface;
-#      should be bridged
 class IPluggableIndex(Interface):
 
     def getId():
@@ -30,8 +28,7 @@
         """Get all information contained for 'documentId'."""
 
     def getIndexSourceNames():
-        """ return a sequence of attribute names that are indexed 
-            by the index. 
+        """Get a sequence of attribute names that are indexed by the index.
         """
 
     def index_object(documentId, obj, threshold=None):
@@ -69,26 +66,24 @@
         records.  The second object is a tuple containing the names of
         all data fields used.
         """
-    
+
     def numObjects():
         """Return the number of indexed objects"""
 
-# XXX: this is currently broken
+# XXX: not implemented by TextIndex and TopicIndex
 #    def indexSize():
 #        """Return the size of the index in terms of distinct values"""
-    
+
     def clear():
         """Empty the index"""
 
 
-# XXX: copied from from common.PluggableIndex.UniqueValueIndex;
-#      should be bridged
 class IUniqueValueIndex(IPluggableIndex):
     """An index which can return lists of unique values contained in it"""
-    
+
     def hasUniqueValuesFor(name):
         """Return true if the index can return the unique values for name"""
-        
+
     def uniqueValues(name=None, withLengths=0):
         """Return the unique values for name.
 
@@ -96,17 +91,15 @@
         (value, length)."""
 
 
-# XXX: copied from from common.PluggableIndex.SortIndex;
-#      should be bridged
 class ISortIndex(IPluggableIndex):
     """An index which may be used to sort a set of document ids"""
-    
+
     def keyForDocument(documentId):
         """Return the sort key that cooresponds to the specified document id
-        
-        This method is no longer used by ZCatalog, but is left for backwards 
+
+        This method is no longer used by ZCatalog, but is left for backwards
         compatibility."""
-        
+
     def documentToKeyMap():
         """Return an object that supports __getitem__ and may be used to quickly
         lookup the sort key given a document id"""

Modified: Zope/trunk/lib/python/Products/ZCatalog/IZCatalog.py
===================================================================
--- Zope/trunk/lib/python/Products/ZCatalog/IZCatalog.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/Products/ZCatalog/IZCatalog.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -1,7 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
+# Copyright (c) 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.
@@ -15,238 +14,13 @@
 $Id$
 """
 
-from Interface import Interface
 
-class IZCatalog(Interface):
-    """ZCatalog object
+# create IZCatalog
+from Interface.bridge import createZope3Bridge
+from interfaces import IZCatalog as z3IZCatalog
+import IZCatalog
 
-    A ZCatalog contains arbitrary index like references to Zope
-    objects.  ZCatalog's can index object attribute using a variety
-    of "plug-in" index types.
+createZope3Bridge(z3IZCatalog, IZCatalog, 'IZCatalog')
 
-    Several index types are included, and others may be added.
-
-      Text -- Text indexes index textual content.  The index can be
-      used to search for objects containing certain words.
-
-      Field -- Field indexes index atomic values.  The index can be
-      used to search for objects that have certain properties.
-
-      Keyword -- Keyword indexes index sequences of values.  The index
-      can be used to search for objects that match one or more of the
-      search terms.
-
-      Path -- Path indexes index URI paths. They allow you to find objects
-      based on their placement in a hierarchy.
-
-      Date -- Date indexes index date and type data. They are a type of field
-      index specifically optimized for indexing dates.
-
-      Date Range -- Date range indexes index time intervals. They are designed
-      for efficient searching of dates falling between two boundaries
-      (such as effective / expiration dates).
-
-      Topic -- Topic indexes store prefiltered sets of documents. They are used
-      to optimize complex queries into a single fast query by prefiltering
-      documents by an expression
-
-    The ZCatalog can maintain a table of extra data about cataloged
-    objects.  This information can be used on search result pages to
-    show information about a search result.
-
-    The meta-data table schema is used to build the schema for
-    ZCatalog Result objects.  The objects have the same attributes
-    as the column of the meta-data table.
-
-    ZCatalog does not store references to the objects themselves, but
-    rather to a unique identifier that defines how to get to the
-    object.  In Zope, this unique identifier is the object's relative
-    path to the ZCatalog (since two Zope objects cannot have the same
-    URL, this is an excellent unique qualifier in Zope).
-
-    """
-
-    def catalog_object(obj, uid, idxs=None, update_metadata=1):
-        """Catalogs the object 'obj' with the unique identifier 'uid'.
-
-        The uid must be a physical path, either absolute or relative to
-        the catalog.
-
-        If provided, idxs specifies the names of indexes to update.
-
-        If update_metadata is specified (the default), the object's metadata
-        is updated.  If it is not, the metadata is left untouched.  This
-        flag has no effect if the object is not yet cataloged (metadata
-        is always added for new objects).
-        """
-
-    def uncatalog_object(uid):
-        """Uncatalogs the object with the unique identifier 'uid'.
-
-        The uid must be a physical path, either absolute or relative to
-        the catalog.
-        """
-
-    def uniqueValuesFor(name):
-        """returns the unique values for a given FieldIndex named 'name'.
-        """
-
-    def getpath(rid):
-        """Return the path to a cataloged object given a 'data_record_id_'
-        """
-
-    def getrid(rid):
-        """Return the 'data_record_id_' to a cataloged object given a path
-        """
-
-    def getobject(rid, REQUEST=None):
-        """Return a cataloged object given a 'data_record_id_'
-        """
-
-    def schema():
-        """Get the meta-data schema
-
-        Returns a sequence of names that correspond to columns in the
-        meta-data table.
-
-        """
-
-    def indexes():
-        """Returns a sequence of names that correspond to indexes.
-        """
-
-    def index_objects():
-        """Returns a sequence of actual index objects.
-
-        NOTE: This returns unwrapped indexes! You should probably use
-        getIndexObjects instead. Some indexes expect to be wrapped.
-        """
-
-    def getIndexObjects():
-        """Returns a list of acquisition wrapped index objects
-        """
-
-    def searchResults(REQUEST=None, **kw):
-        """Search the catalog.
-
-        Search terms can be passed in the REQUEST or as keyword
-        arguments.
-
-        Search queries consist of a mapping of index names to search
-        parameters.  You can either pass a mapping to searchResults as
-        the variable 'REQUEST' or you can use index names and search
-        parameters as keyword arguments to the method, in other words::
-
-          searchResults(title='Elvis Exposed',
-                        author='The Great Elvonso')
-
-        is the same as::
-
-          searchResults({'title' : 'Elvis Exposed',
-                         'author : 'The Great Elvonso'})
-
-        In these examples, 'title' and 'author' are indexes.  This
-        query will return any objects that have the title *Elvis
-        Exposed* AND also are authored by *The Great Elvonso*.  Terms
-        that are passed as keys and values in a searchResults() call
-        are implicitly ANDed together. To OR two search results, call
-        searchResults() twice and add concatenate the results like this::
-
-          results = ( searchResults(title='Elvis Exposed') +
-                      searchResults(author='The Great Elvonso') )
-
-        This will return all objects that have the specified title OR
-        the specified author.
-
-        There are some special index names you can pass to change the
-        behavior of the search query:
-
-          sort_on -- This parameters specifies which index to sort the
-          results on.
-
-          sort_order -- You can specify 'reverse' or 'descending'.
-          Default behavior is to sort ascending.
-
-          sort_limit -- An optimization hint to tell the catalog how many
-          results you are really interested in. See the limit argument
-          to the search method for more details.
-
-        There are some rules to consider when querying this method:
-
-            - an empty query mapping (or a bogus REQUEST) returns all
-              items in the catalog.
-
-            - results from a query involving only field/keyword
-              indexes, e.g.  {'id':'foo'} and no 'sort_on' will be
-              returned unsorted.
-
-            - results from a complex query involving a field/keyword
-              index *and* a text index,
-              e.g. {'id':'foo','PrincipiaSearchSource':'bar'} and no
-              'sort_on' will be returned unsorted.
-
-            - results from a simple text index query
-              e.g.{'PrincipiaSearchSource':'foo'} will be returned
-              sorted in descending order by 'score'.  A text index
-              cannot beused as a 'sort_on' parameter, and attempting
-              to do so will raise an error.
-
-        Depending on the type of index you are querying, you may be
-        able to provide more advanced search parameters that can
-        specify range searches or wildcards.  These features are
-        documented in The Zope Book.
-
-        """
-
-    def __call__(REQUEST=None, **kw):
-        """Search the catalog, the same way as 'searchResults'.
-        """
-
-    def search(query_request, sort_index=None, reverse=0, limit=None, merge=1):
-        """Programmatic search interface, use for searching the catalog from
-        scripts.
-
-        query_request -- Dictionary containing catalog query. This uses the
-        same format as searchResults.
-
-        sort_index -- Name of sort index
-
-        reverse -- Boolean, reverse sort order (defaults to false)
-
-        limit -- Limit sorted result count to the n best records. This is an
-        optimization hint used in conjunction with a sort_index. If possible
-        ZCatalog will use a different sort algorithm that uses much less memory
-        and scales better then a full sort. The actual number of records
-        returned is not guaranteed to be <= limit. You still need to apply the
-        same batching to the results. Since the len() of the results will no
-        longer be the actual result count, you can use the
-        "actual_result_count" attribute of the lazy result object instead to
-        determine the size of the full result set.
-
-        merge -- Return merged, lazy results (like searchResults) or raw
-        results for later merging. This can be used to perform multiple
-        queries (even across catalogs) and merge and sort the combined results.
-        """
-
-    def refreshCatalog(clear=0, pghandler=None):
-        """Reindex every object we can find, removing the unreachable
-        ones from the index.
-
-        clear -- values: 1|0  clear the catalog before reindexing
-
-        pghandler -- optional Progresshandler as defined in ProgressHandler.py
-        (see also README.txt)
-        """
-
-    def reindexIndex(name, REQUEST, pghandler=None):
-        """Reindex a single index.
-
-        name -- id of index
-
-        REQUEST -- REQUEST object
-
-        pghandler -- optional Progresshandler as defined in ProgressHandler.py
-        (see also README.txt)
-        """
-
-__doc__ = IZCatalog.__doc__ + __doc__
+del createZope3Bridge
+del z3IZCatalog


Property changes on: Zope/trunk/lib/python/Products/ZCatalog/IZCatalog.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.7

Modified: Zope/trunk/lib/python/Products/ZCatalog/interfaces.py
===================================================================
--- Zope/trunk/lib/python/Products/ZCatalog/interfaces.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/Products/ZCatalog/interfaces.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -18,8 +18,6 @@
 from zope.interface import Interface
 
 
-# XXX: copied from IZCatalog.IZCatalog;
-#      should be bridged
 class IZCatalog(Interface):
     """ZCatalog object
 
@@ -66,7 +64,6 @@
     object.  In Zope, this unique identifier is the object's relative
     path to the ZCatalog (since two Zope objects cannot have the same
     URL, this is an excellent unique qualifier in Zope).
-
     """
 
     def catalog_object(obj, uid, idxs=None, update_metadata=1):
@@ -111,7 +108,6 @@
 
         Returns a sequence of names that correspond to columns in the
         meta-data table.
-
         """
 
     def indexes():
@@ -198,7 +194,6 @@
         able to provide more advanced search parameters that can
         specify range searches or wildcards.  These features are
         documented in The Zope Book.
-
         """
 
     def __call__(REQUEST=None, **kw):

Modified: Zope/trunk/lib/python/webdav/Collection.py
===================================================================
--- Zope/trunk/lib/python/webdav/Collection.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/webdav/Collection.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -7,7 +7,7 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
 """WebDAV support - collection objects.
@@ -15,22 +15,31 @@
 $Id$
 """
 
-import Globals, davcmds, Lockable
-from common import urlfix, rfc1123_date
-from Resource import Resource
+from urllib import unquote
+
+import Globals
 from AccessControl import getSecurityManager
-from urllib import unquote
 from zExceptions import MethodNotAllowed, NotFound
-from webdav.common import Locked, PreconditionFailed
+from zope.interface import implements
 
+import davcmds
+import Lockable
+from common import Locked, PreconditionFailed
+from common import urlfix, rfc1123_date
+from interfaces import IDAVCollection
+from Resource import Resource
 
+
 class Collection(Resource):
+
     """The Collection class provides basic WebDAV support for
     collection objects. It provides default implementations
     for all supported WebDAV HTTP methods. The behaviors of some
     WebDAV HTTP methods for collections are slightly different
     than those for non-collection resources."""
 
+    implements(IDAVCollection)
+
     __dav_collection__=1
 
     def dav__init(self, request, response):

Modified: Zope/trunk/lib/python/webdav/Resource.py
===================================================================
--- Zope/trunk/lib/python/webdav/Resource.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/webdav/Resource.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -7,10 +7,9 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-
 """WebDAV support - resource objects.
 
 $Id$
@@ -20,29 +19,36 @@
 import mimetypes
 from urllib import unquote
 
+import ExtensionClass
 import Globals
-import ExtensionClass
+from AccessControl import getSecurityManager
 from Acquisition import aq_base
-from AccessControl import getSecurityManager
+from zExceptions import BadRequest, MethodNotAllowed
+from zExceptions import Unauthorized, Forbidden
+from zope.interface import implements
 from ZPublisher.HTTPRangeSupport import HTTPRangeInterface
-from zExceptions import Unauthorized, Forbidden
-from zExceptions import BadRequest, MethodNotAllowed 
 
-from WriteLockInterface import WriteLockInterface
+import davcmds
 import Lockable
 from common import absattr, urlfix, rfc1123_date, tokenFinder, urlbase
 from common import IfParser
 from common import isDavCollection
 from common import Locked, Conflict, PreconditionFailed
-import davcmds
+from interfaces import IDAVResource
+from interfaces import IWriteLock
+from WriteLockInterface import WriteLockInterface
 
+
 class Resource(ExtensionClass.Base, Lockable.LockableItem):
+
     """The Resource mixin class provides basic WebDAV support for
     non-collection objects. It provides default implementations
     for most supported WebDAV HTTP methods, however certain methods
     such as PUT should be overridden to ensure correct behavior in
     the context of the object type."""
 
+    implements(IDAVResource, IWriteLock)
+
     __dav_resource__=1
 
     __http_methods__=('GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'OPTIONS',
@@ -598,5 +604,4 @@
     def listDAVObjects(self):
         return []
 
-        
 Globals.default__class_init__(Resource)


Property changes on: Zope/trunk/lib/python/webdav/Resource.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.60

Modified: Zope/trunk/lib/python/webdav/WriteLockInterface.py
===================================================================
--- Zope/trunk/lib/python/webdav/WriteLockInterface.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/webdav/WriteLockInterface.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -19,6 +19,7 @@
 
 
 class LockItemInterface(Interface):
+
     """A LockItem contains information about a lock.
 
     This includes:
@@ -144,71 +145,12 @@
         used when returning the value of a newly created lock. """
 
 
-class WriteLockInterface(Interface):
-    """Basic protocol needed to support the write lock machinery.
+# create WriteLockInterface
+from Interface.bridge import createZope3Bridge
+from interfaces import IWriteLock
+import WriteLockInterface
 
-    It must be able to answer the questions:
+createZope3Bridge(IWriteLock, WriteLockInterface, 'WriteLockInterface')
 
-     o Is the object locked?
-
-     o Is the lock owned by the current user?
-
-     o What lock tokens are associated with the current object?
-
-     o What is their state (how long until they're supposed to time out?,
-       what is their depth?  what type are they?
-
-    And it must be able to do the following:
-
-     o Grant a write lock on the object to a specified user.
-
-       - *If lock depth is infinite, this must also grant locks on **all**
-         subobjects, or fail altogether*
-
-     o Revoke a lock on the object.
-
-       - *If lock depth is infinite, this must also revoke locks on all
-         subobjects*
-
-    **All methods in the WriteLock interface that deal with checking valid
-    locks MUST check the timeout values on the lockitem (ie, by calling
-    'lockitem.isValid()'), and DELETE the lock if it is no longer valid**
-    """
-
-    def wl_lockItems(killinvalids=0):
-        """ Returns (key, value) pairs of locktoken, lock.
-
-        if 'killinvalids' is true, invalid locks (locks whose timeout
-        has been exceeded) will be deleted"""
-
-    def wl_lockValues(killinvalids=0):
-        """ Returns a sequence of locks.  if 'killinvalids' is true,
-        invalid locks will be deleted"""
-
-    def wl_lockTokens(killinvalids=0):
-        """ Returns a sequence of lock tokens.  if 'killinvalids' is true,
-        invalid locks will be deleted"""
-
-    def wl_hasLock(token, killinvalids=0):
-        """ Returns true if the lock identified by the token is attached
-        to the object. """
-
-    def wl_isLocked():
-        """ Returns true if 'self' is locked at all.  If invalid locks
-        still exist, they should be deleted."""
-
-    def wl_setLock(locktoken, lock):
-        """ Store the LockItem, 'lock'.  The locktoken will be used to fetch
-        and delete the lock.  If the lock exists, this MUST
-        overwrite it if all of the values except for the 'timeout' on the
-        old and new lock are the same. """
-
-    def wl_getLock(locktoken):
-        """ Returns the locktoken identified by the locktokenuri """
-
-    def wl_delLock(locktoken):
-        """ Deletes the locktoken identified by the locktokenuri """
-
-    def wl_clearLocks():
-        """ Deletes ALL DAV locks on the object - should only be called
-        by lock management machinery. """
+del createZope3Bridge
+del IWriteLock

Modified: Zope/trunk/lib/python/webdav/interfaces.py
===================================================================
--- Zope/trunk/lib/python/webdav/interfaces.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/webdav/interfaces.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -19,18 +19,77 @@
 from zope.schema import Bool, Tuple
 
 
-# create IWriteLock
-from Products.Five.fiveconfigure import createZope2Bridge
-from webdav.WriteLockInterface import WriteLockInterface
-import interfaces
+class IWriteLock(Interface):
 
-createZope2Bridge(WriteLockInterface, interfaces, 'IWriteLock')
+    """Basic protocol needed to support the write lock machinery.
 
-del createZope2Bridge
-del WriteLockInterface
-del interfaces
+    It must be able to answer the questions:
 
+     o Is the object locked?
 
+     o Is the lock owned by the current user?
+
+     o What lock tokens are associated with the current object?
+
+     o What is their state (how long until they're supposed to time out?,
+       what is their depth?  what type are they?
+
+    And it must be able to do the following:
+
+     o Grant a write lock on the object to a specified user.
+
+       - *If lock depth is infinite, this must also grant locks on **all**
+         subobjects, or fail altogether*
+
+     o Revoke a lock on the object.
+
+       - *If lock depth is infinite, this must also revoke locks on all
+         subobjects*
+
+    **All methods in the WriteLock interface that deal with checking valid
+    locks MUST check the timeout values on the lockitem (ie, by calling
+    'lockitem.isValid()'), and DELETE the lock if it is no longer valid**
+    """
+
+    def wl_lockItems(killinvalids=0):
+        """ Returns (key, value) pairs of locktoken, lock.
+
+        if 'killinvalids' is true, invalid locks (locks whose timeout
+        has been exceeded) will be deleted"""
+
+    def wl_lockValues(killinvalids=0):
+        """ Returns a sequence of locks.  if 'killinvalids' is true,
+        invalid locks will be deleted"""
+
+    def wl_lockTokens(killinvalids=0):
+        """ Returns a sequence of lock tokens.  if 'killinvalids' is true,
+        invalid locks will be deleted"""
+
+    def wl_hasLock(token, killinvalids=0):
+        """ Returns true if the lock identified by the token is attached
+        to the object. """
+
+    def wl_isLocked():
+        """ Returns true if 'self' is locked at all.  If invalid locks
+        still exist, they should be deleted."""
+
+    def wl_setLock(locktoken, lock):
+        """ Store the LockItem, 'lock'.  The locktoken will be used to fetch
+        and delete the lock.  If the lock exists, this MUST
+        overwrite it if all of the values except for the 'timeout' on the
+        old and new lock are the same. """
+
+    def wl_getLock(locktoken):
+        """ Returns the locktoken identified by the locktokenuri """
+
+    def wl_delLock(locktoken):
+        """ Deletes the locktoken identified by the locktokenuri """
+
+    def wl_clearLocks():
+        """ Deletes ALL DAV locks on the object - should only be called
+        by lock management machinery. """
+
+
 # XXX: might contain non-API methods and outdated comments;
 #      not synced with ZopeBook API Reference;
 #      based on webdav.Resource.Resource

Modified: Zope/trunk/lib/python/webdav/tests/testCollection.py
===================================================================
--- Zope/trunk/lib/python/webdav/tests/testCollection.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/webdav/tests/testCollection.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -1,7 +1,4 @@
 import unittest
-import Testing
-import Zope2
-Zope2.startup()
 
 
 class TestCollection(unittest.TestCase):
@@ -11,7 +8,7 @@
         from webdav.interfaces import IDAVCollection
         from zope.interface.verify import verifyClass
 
-        verifyClass(IDAVCollection, Collection, 1)
+        verifyClass(IDAVCollection, Collection)
 
 
 def test_suite():

Modified: Zope/trunk/lib/python/webdav/tests/testNullResource.py
===================================================================
--- Zope/trunk/lib/python/webdav/tests/testNullResource.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/webdav/tests/testNullResource.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -1,7 +1,4 @@
 import unittest
-import Testing
-import Zope2
-Zope2.startup()
 
 
 class TestLockNullResource(unittest.TestCase):
@@ -18,7 +15,7 @@
         from webdav.NullResource import LockNullResource
         from zope.interface.verify import verifyClass
 
-        verifyClass(IWriteLock, LockNullResource, 1)
+        verifyClass(IWriteLock, LockNullResource)
 
 
 class TestNullResource(unittest.TestCase):
@@ -35,7 +32,7 @@
         from webdav.NullResource import NullResource
         from zope.interface.verify import verifyClass
 
-        verifyClass(IWriteLock, NullResource, 1)
+        verifyClass(IWriteLock, NullResource)
 
 
 def test_suite():

Modified: Zope/trunk/lib/python/webdav/tests/testResource.py
===================================================================
--- Zope/trunk/lib/python/webdav/tests/testResource.py	2005-07-13 01:42:51 UTC (rev 33293)
+++ Zope/trunk/lib/python/webdav/tests/testResource.py	2005-07-13 10:56:36 UTC (rev 33294)
@@ -1,17 +1,16 @@
 import unittest
-import Testing
-import Zope2
-Zope2.startup()
 
 
 class TestResource(unittest.TestCase):
 
     def test_z3interfaces(self):
         from webdav.interfaces import IDAVResource
+        from webdav.interfaces import IWriteLock
         from webdav.Resource import Resource
         from zope.interface.verify import verifyClass
 
-        verifyClass(IDAVResource, Resource, 1)
+        verifyClass(IDAVResource, Resource)
+        verifyClass(IWriteLock, Resource)
 
 
 def test_suite():



More information about the Zope-Checkins mailing list