From dce6de9f457e0bc539edb529dd86a04f6bd9112d Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Mon, 28 Apr 2008 15:18:59 +0000 Subject: [PATCH] Zope2 Interfaces package delenda est\! --- IZCatalog.py | 26 -------------------------- ProgressHandler.py | 9 +++++---- ZCatalog.py | 12 ++++-------- ZCatalogIndexes.py | 4 +--- tests/testCatalog.py | 7 ------- 5 files changed, 10 insertions(+), 48 deletions(-) delete mode 100644 IZCatalog.py diff --git a/IZCatalog.py b/IZCatalog.py deleted file mode 100644 index ec3ebd35..00000000 --- a/IZCatalog.py +++ /dev/null @@ -1,26 +0,0 @@ -############################################################################## -# -# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved. -# -# This software is subject to the provisions of the Zope Public License, -# Version 2.1 (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. -# -############################################################################## -""" -$Id$ -""" - - -# create IZCatalog -from Interface.bridge import createZope3Bridge -from interfaces import IZCatalog as z3IZCatalog -import IZCatalog - -createZope3Bridge(z3IZCatalog, IZCatalog, 'IZCatalog') - -del createZope3Bridge -del z3IZCatalog diff --git a/ProgressHandler.py b/ProgressHandler.py index c2ebb444..38b4fe92 100644 --- a/ProgressHandler.py +++ b/ProgressHandler.py @@ -18,7 +18,8 @@ from logging import getLogger from DateTime.DateTime import DateTime -from Interface import Interface +from zope.interface import Interface +from zope.interface import implements LOG = getLogger('ProgressHandler') @@ -54,7 +55,7 @@ def output(text): class StdoutHandler: """ A simple progress handler """ - __implements__ = IProgressHandler + implements(IProgressHandler) def __init__(self, steps=100): self._steps = steps @@ -89,7 +90,7 @@ def output(self, text): class ZLogHandler(StdoutHandler): """ Use Zope logger""" - __implements__ = IProgressHandler + implements(IProgressHandler) def output(self, text): LOG.info(text) @@ -98,7 +99,7 @@ def output(self, text): class FilelogHandler(StdoutHandler): """ Use a custom file for logging """ - __implements__ = IProgressHandler + implements(IProgressHandler) def __init__(self, filename, steps=100): StdoutHandler.__init__(self, steps) diff --git a/ZCatalog.py b/ZCatalog.py index d334d141..2ac60efd 100644 --- a/ZCatalog.py +++ b/ZCatalog.py @@ -34,14 +34,11 @@ manage_zcatalog_entries, manage_zcatalog_indexes, search_zcatalog from ZODB.POSException import ConflictError import transaction -from Products.PluginIndexes.common.PluggableIndex \ - import PluggableIndexInterface from Products.PluginIndexes.interfaces import IPluggableIndex from zope.interface import implements from Catalog import Catalog, CatalogError -from interfaces import IZCatalog as z3IZCatalog -from IZCatalog import IZCatalog as z2IZCatalog +from interfaces import IZCatalog from ProgressHandler import ZLogHandler from ZCatalogIndexes import ZCatalogIndexes @@ -82,8 +79,7 @@ class is that it is not Zope specific. You can use it in any Python program to catalog objects. """ - __implements__ = z2IZCatalog - implements(z3IZCatalog) + implements(IZCatalog) security = ClassSecurityInfo() security.setPermissionDefault(manage_zcatalog_entries, ('Manager',)) @@ -958,8 +954,8 @@ def addIndex(self, name, type,extra=None): # Convert the type by finding an appropriate product which supports # this interface by that name. Bleah - products = ObjectManager.all_meta_types(self, interfaces=( - PluggableIndexInterface, IPluggableIndex)) + products = ObjectManager.all_meta_types(self, + interfaces=(IPluggableIndex,)) p = None diff --git a/ZCatalogIndexes.py b/ZCatalogIndexes.py index cd9517e4..6446b1bc 100644 --- a/ZCatalogIndexes.py +++ b/ZCatalogIndexes.py @@ -23,8 +23,6 @@ from OFS.Folder import Folder from OFS.ObjectManager import IFAwareObjectManager from OFS.SimpleItem import SimpleItem -from Products.PluginIndexes.common.PluggableIndex \ - import PluggableIndexInterface from Products.PluginIndexes.interfaces import IPluggableIndex @@ -37,7 +35,7 @@ class ZCatalogIndexes(IFAwareObjectManager, Folder, Persistent, Implicit): the requested indexes in an object manager.""" # The interfaces we want to show up in our object manager - _product_interfaces = (PluggableIndexInterface, IPluggableIndex) + _product_interfaces = (IPluggableIndex,) meta_type = "ZCatalogIndex" manage_options = () diff --git a/tests/testCatalog.py b/tests/testCatalog.py index f46cad99..b8d015d2 100644 --- a/tests/testCatalog.py +++ b/tests/testCatalog.py @@ -215,13 +215,6 @@ def setUp(self): def _resolve_num(self, num): return self.d[num] - def test_z2interfaces(self): - from Interface.Verify import verifyClass - from Products.ZCatalog.IZCatalog import IZCatalog - from Products.ZCatalog.ZCatalog import ZCatalog - - verifyClass(IZCatalog, ZCatalog) - def test_z3interfaces(self): from Products.ZCatalog.interfaces import IZCatalog from Products.ZCatalog.ZCatalog import ZCatalog