[Zope3-checkins] CVS: Zope3/src/zope/app/component - classfactory.py:1.1.2.2 globalinterfaceservice.py:1.1.2.2 hooks.py:1.1.2.3 interfacefield.py:1.1.2.2 metaconfigure.py:1.1.2.3 nextservice.py:1.1.2.3
Tim Peters
tim.one@comcast.net
Tue, 24 Dec 2002 21:21:53 -0500
Update of /cvs-repository/Zope3/src/zope/app/component
In directory cvs.zope.org:/tmp/cvs-serv19240/src/zope/app/component
Modified Files:
Tag: NameGeddon-branch
classfactory.py globalinterfaceservice.py hooks.py
interfacefield.py metaconfigure.py nextservice.py
Log Message:
Whitespace normalization, via Python's Tools/scripts/reindent.py. The
files are fixed-points of that script now. Fixed a few cases where
code relied on significant trailing whitespace (ouch).
=== Zope3/src/zope/app/component/classfactory.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/component/classfactory.py:1.1.2.1 Mon Dec 23 14:31:26 2002
+++ Zope3/src/zope/app/component/classfactory.py Tue Dec 24 21:20:22 2002
@@ -2,14 +2,14 @@
#
# 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.
-#
+#
##############################################################################
"$Id$"
@@ -17,7 +17,7 @@
class ClassFactory:
"Class that creates a factory component from a class"
-
+
__implements__ = IFactory
def __init__(self, _class):
@@ -25,7 +25,7 @@
def __call__(self, *args, **kwargs):
return self._class(*args, **kwargs)
-
+
def getInterfaces(self):
return getattr(self._class, '__implements__', None)
=== Zope3/src/zope/app/component/globalinterfaceservice.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/component/globalinterfaceservice.py:1.1.2.1 Mon Dec 23 14:31:26 2002
+++ Zope3/src/zope/app/component/globalinterfaceservice.py Tue Dec 24 21:20:22 2002
@@ -2,14 +2,14 @@
#
# 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.
-#
+#
##############################################################################
"""
$Id$
@@ -41,7 +41,7 @@
If base is given, only interfaces that equal or extend base
will be returned.
-
+
"""
def searchInterfaceIds(search_string='', base=None):
@@ -68,7 +68,7 @@
if data is None:
data = {}
self.__data = data
-
+
def getInterface(self, id):
if id in self.__data:
return self.__data[id][0]
@@ -89,7 +89,7 @@
for id in data:
interface, doc = data[id]
-
+
if search_string:
if doc.find(search_string) < 0:
continue
@@ -105,7 +105,7 @@
data = self.__data
return [data[id][0]
for id in self.searchInterfaceIds(search_string, base)]
-
+
def _getAllDocs(self,interface):
docs = [str(interface.__name__).lower(),
str(interface.__doc__).lower()]
@@ -114,14 +114,14 @@
docs.append(str(interface.getDescriptionFor(name).__doc__).lower())
return '\n'.join(docs)
-
+
def provideInterface(self, id, interface):
if not id:
id = "%s.%s" % (interface.__module__, interface.__name__)
-
+
self.__data[id]=(interface, self._getAllDocs(interface))
-
- _clear = __init__
+
+ _clear = __init__
=== Zope3/src/zope/app/component/hooks.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/component/hooks.py:1.1.2.2 Mon Dec 23 18:52:31 2002
+++ Zope3/src/zope/app/component/hooks.py Tue Dec 24 21:20:22 2002
@@ -2,14 +2,14 @@
#
# 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.
-#
+#
##############################################################################
"""
@@ -25,7 +25,7 @@
from zope.component.service import serviceManager
from zope.proxy.introspection import removeAllProxies
from zope.security.proxy import trustedRemoveSecurityProxy
-
+
def getServiceManager_hook(context):
"""
context based lookup, with fallback to component architecture
@@ -37,7 +37,7 @@
# if the context is actually a service or service manager...
if IServiceService.isImplementedBy(clean_context):
return trustedRemoveSecurityProxy(context)
-
+
if (IServiceManagerContainer.isImplementedBy(clean_context) and
clean_context.hasServiceManager()
):
@@ -46,7 +46,7 @@
context,
name="++etc++Services",
)
-
+
context = getWrapperContainer(context)
return serviceManager
=== Zope3/src/zope/app/component/interfacefield.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/component/interfacefield.py:1.1.2.1 Mon Dec 23 14:31:26 2002
+++ Zope3/src/zope/app/component/interfacefield.py Tue Dec 24 21:20:22 2002
@@ -2,14 +2,14 @@
#
# 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.
# 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.
-#
+#
##############################################################################
"""These are the interfaces for the common fields.
@@ -30,7 +30,7 @@
description=u"All values must extend (or be) this type",
default=Interface,
)
-
+
class InterfaceField(ValueSet):
__doc__ = IInterfaceField.__doc__
__implements__ = IInterfaceField
@@ -40,7 +40,7 @@
def __init__(self, type=Interface, *args, **kw):
super(InterfaceField, self).__init__(*args, **kw)
self.validate(type)
- self.type = type
+ self.type = type
def _validate(self, value):
super(InterfaceField, self)._validate(value)
@@ -50,5 +50,3 @@
if not value.extends(self.type, 0):
raise ValidationError("Does not extend", value, self.type)
-
-
=== Zope3/src/zope/app/component/metaconfigure.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/component/metaconfigure.py:1.1.2.2 Tue Dec 24 07:50:58 2002
+++ Zope3/src/zope/app/component/metaconfigure.py Tue Dec 24 21:20:22 2002
@@ -2,14 +2,14 @@
#
# 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.
-#
+#
##############################################################################
from zope.configuration.exceptions import ConfigurationError
@@ -37,7 +37,7 @@
def handler(serviceName, methodName, *args, **kwargs):
method=getattr(getService(None, serviceName), methodName)
method(*args, **kwargs)
-
+
# We can't use the handler for serviceType, because serviceType needs
# the interface service.
from zope.app.component.globalinterfaceservice import provideInterface
@@ -77,7 +77,7 @@
Action(
discriminator = ('adapter', for_, provides, name),
callable = checkingHandler,
- args = (permission, 'Adapters', 'provideAdapter',
+ args = (permission, 'Adapters', 'provideAdapter',
for_, provides, factory, name),
),
Action(
@@ -95,7 +95,7 @@
args = ('Interfaces', 'provideInterface', '', for_)
)
)
-
+
return actions
@@ -130,14 +130,14 @@
callable = handler,
args = ('Interfaces', 'provideInterface',
provides.__module__+'.'+provides.__name__, provides)
- )
+ )
]
def factory(_context, component, id=None):
if id is None:
id = component
-
+
component = _context.resolve(component)
return [
@@ -177,7 +177,7 @@
"allowed_attributes"
)
-
+
type = _context.resolve(type)
factory = _context.resolve(factory)
@@ -191,7 +191,7 @@
return Proxy(factory(request), checker)
factory = proxyResource
-
+
return [
Action(
discriminator = ('resource', name, type, layer),
@@ -204,7 +204,7 @@
callable = handler,
args = ('Interfaces', 'provideInterface',
type.__module__+'.'+type.__name__, type)
- )
+ )
]
def view(_context, factory, type, name, for_=None, layer='default',
@@ -246,7 +246,7 @@
callable = handler,
args = ('Interfaces', 'provideInterface',
type.__module__+'.'+type.__name__, type)
- )
+ )
]
if for_ is not None:
actions.append
@@ -284,7 +284,7 @@
callable = handler,
args = ('Interfaces', 'provideInterface',
type.__module__+'.'+type.__name__, type)
- )
+ )
]
if for_ is not None:
actions.append
@@ -303,7 +303,7 @@
interface = _context.resolve(interface)
return [
Action(
- discriminator = ('serviceType', id),
+ discriminator = ('serviceType', id),
callable = managerHandler,
args = ('defineService', id, interface),
),
@@ -323,7 +323,7 @@
service_manager = getServiceManager(None)
if permission:
-
+
for stype, interface in service_manager.getServiceDefinitions():
if stype == serviceType:
break
@@ -332,7 +332,7 @@
if permission == 'zope.Public':
permission = CheckerPublic
-
+
checker = InterfaceChecker(interface, permission)
try:
@@ -341,7 +341,7 @@
component = Proxy(component, checker)
service_manager.provideService(serviceType, component)
-
+
def service(_context, serviceType, component=None, permission=None,
factory=None):
if factory:
@@ -354,7 +354,7 @@
return [
Action(
- discriminator = ('service', serviceType),
+ discriminator = ('service', serviceType),
callable = provideService,
args = (serviceType, component, permission),
)
@@ -377,6 +377,6 @@
callable = handler,
args = ('Interfaces', 'provideInterface',
type.__module__+'.'+type.__name__, type)
- )
+ )
]
return actions
=== Zope3/src/zope/app/component/nextservice.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/component/nextservice.py:1.1.2.2 Mon Dec 23 18:52:31 2002
+++ Zope3/src/zope/app/component/nextservice.py Tue Dec 24 21:20:22 2002
@@ -2,14 +2,14 @@
#
# 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.
# 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.
-#
+#
##############################################################################
"""Support for delegation among service managers
@@ -30,13 +30,13 @@
return getNextServiceManager(context)
except ComponentLookupError:
return default
-
+
def getNextService(context, name):
service = queryNextService(context, name)
if service is None:
raise ComponentLookupError('service', name)
return service
-
+
def queryNextService(context, name, default=None):
try:
sm = getNextServiceManager(context)
@@ -62,7 +62,7 @@
container = getWrapperContainer(sm)
# But we're *really* paranoid, so we'll double check.
- while ((container is not None) and not
+ while ((container is not None) and not
IServiceManagerContainer.isImplementedBy(
removeAllProxies(container))
):