[Zope3-checkins] CVS: Zope3/src/zope/component - __init__.py:1.1.2.2 adapter.py:1.1.2.2 contextdependent.py:1.1.2.2 exceptions.py:1.1.2.2 factory.py:1.1.2.2 interfaces.py:1.1.2.4 resource.py:1.1.2.3 service.py:1.1.2.3 skin.py:1.1.2.3 utility.py:1.1.2.2 view.py:1.1.2.2
Tim Peters
tim.one@comcast.net
Tue, 24 Dec 2002 21:21:29 -0500
Update of /cvs-repository/Zope3/src/zope/component
In directory cvs.zope.org:/tmp/cvs-serv19240/src/zope/component
Modified Files:
Tag: NameGeddon-branch
__init__.py adapter.py contextdependent.py exceptions.py
factory.py interfaces.py resource.py service.py skin.py
utility.py view.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/component/__init__.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/component/__init__.py:1.1.2.1 Mon Dec 23 14:32:40 2002
+++ Zope3/src/zope/component/__init__.py Tue Dec 24 21:20:57 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.
-#
+#
##############################################################################
"""
@@ -43,7 +43,7 @@
return default
return sm.queryService(name, default)
-def getServiceDefinitions(context):
+def getServiceDefinitions(context):
return getServiceManager(context).getServiceDefinitions()
# Utility service
@@ -71,7 +71,7 @@
except ComponentLookupError:
# Oh blast, no adapter service. We're probably just running from a test
return default
-
+
return adapters.queryAdapter(
object, interface, default, name)
@@ -92,22 +92,22 @@
# Skin service
def getSkin(wrapped_object, name, view_type):
- return getService(wrapped_object,
+ return getService(wrapped_object,
'Skins').getSkin(wrapped_object, name, view_type)
# View service
def getView(wrapped_object, name, request):
- return getService(wrapped_object,
+ return getService(wrapped_object,
'Views').getView(wrapped_object, name, request)
def queryView(wrapped_object, name, request, default=None):
- return getService(wrapped_object,
+ return getService(wrapped_object,
'Views').queryView(wrapped_object, name,
request, default)
def getDefaultViewName(wrapped_object, request):
- return getService(wrapped_object,
+ return getService(wrapped_object,
'Views').getDefaultViewName(wrapped_object,
request)
=== Zope3/src/zope/component/adapter.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/component/adapter.py:1.1.2.1 Mon Dec 23 14:32:40 2002
+++ Zope3/src/zope/component/adapter.py Tue Dec 24 21:20:57 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.
-#
+#
##############################################################################
"""adapter service
"""
@@ -51,12 +51,12 @@
"""
class GlobalAdapterService:
-
+
__implements__ = IGlobalAdapterService
-
+
def __init__(self):
self.__adapters = {}
-
+
def provideAdapter(self, forInterface, providedInterface, maker, name=''):
"""see IGlobalAdapterService interface"""
@@ -73,7 +73,7 @@
if registry is None:
registry = AdapterRegistry()
self.__adapters[name] = registry
-
+
registry.register(forInterface, providedInterface, maker)
def getAdapter(self, object, interface, name=''):
@@ -83,8 +83,8 @@
raise ComponentLookupError(object, interface)
return result
-
-
+
+
def queryAdapter(self, object, interface, default=None, name=''):
"""see IAdapterService interface"""
if (not name) and interface.isImplementedBy(object):
@@ -93,7 +93,7 @@
registry = self.__adapters.get(name)
if registry is None:
return default
-
+
makers = registry.getForObject(object, interface)
if makers is None:
=== Zope3/src/zope/component/contextdependent.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/component/contextdependent.py:1.1.2.1 Mon Dec 23 14:32:40 2002
+++ Zope3/src/zope/component/contextdependent.py Tue Dec 24 21:20:57 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,4 +25,3 @@
def __init__(self, context):
self.context = context
-
=== Zope3/src/zope/component/exceptions.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/component/exceptions.py:1.1.2.1 Mon Dec 23 14:32:40 2002
+++ Zope3/src/zope/component/exceptions.py Tue Dec 24 21:20:57 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.exceptions import NotFoundError
=== Zope3/src/zope/component/factory.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/component/factory.py:1.1.2.1 Mon Dec 23 14:32:40 2002
+++ Zope3/src/zope/component/factory.py Tue Dec 24 21:20:57 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.
-#
+#
##############################################################################
"""factory service
"""
@@ -27,9 +27,9 @@
"""
class GlobalFactoryService:
-
+
__implements__ = IGlobalFactoryService
-
+
def __init__(self):
self.__factories={}
@@ -55,7 +55,7 @@
def queryFactory(self, name, default=None):
"""See IFactoryService interface"""
return self.__factories.get(name, default)
-
+
def getInterfaces(self, name):
"""See IFactoryService interface"""
try: return self.__factories[name].getInterfaces()
=== Zope3/src/zope/component/interfaces.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/component/interfaces.py:1.1.2.3 Tue Dec 24 07:51:24 2002
+++ Zope3/src/zope/component/interfaces.py Tue Dec 24 21:20:57 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.
-#
+#
##############################################################################
"""
@@ -24,7 +24,7 @@
"""
# basic service manager tools
-
+
def getServiceManager(context):
"""returns the nearest service manager to the context; if the
context is None the global service manager is always returned"""
@@ -34,7 +34,7 @@
if the context is None the pertinent global service is always
returned"""
- def getServiceDefinitions(context):
+ def getServiceDefinitions(context):
"""returns a dictionary of the service definitions pertinent to
the given context, in the format {nameString: serviceInterface}.
If the context is None the global definitions will be returned.
@@ -105,7 +105,7 @@
object, as specified by the name and the view type (browser,
xml-rpc, etc.) as expressed by an interface. If a matching
skin is not found, raises ComponentLookupError
-
+
There is a predefined skin in the global skin service, '', with
a single layer, ''."""
@@ -118,7 +118,7 @@
the view type and the skin name. The nearest one to the
object is found. If a matching view cannot be found, raises
ComponentLookupError.
-
+
"""
def queryView(wrapped_object, name, request, default=None):
@@ -137,17 +137,17 @@
desired view type. The nearest one to the object is found.
If a matching default view name cannot be found, raises
NotFoundError.
-
+
"""
def queryDefaultViewName(wrapped_object, request, default=None):
"""Look for the name of the default view for the object and request.
-
+
The request must implement IPresentationRequest, and provides the
desired view type. The nearest one to the object is found.
If a matching default view name cannot be found, returns the
default.
-
+
"""
# Resource service
@@ -158,7 +158,7 @@
The request must implement IPresentationRequest.
The object provides a place to look for placeful resources.
-
+
A ComponentLookupError will be raised if the component can't
be found.
@@ -170,7 +170,7 @@
The request must implement IPresentationRequest.
The object provides a place to look for placeful resources.
-
+
If the component can't be found, the default is returned.
"""
@@ -180,11 +180,11 @@
"""Retrieve all Service Definitions
Should return a list of tuples (name, interface)
- """
+ """
def getInterfaceFor(name):
"""Retrieve the service interface for the given name
- """
+ """
def getService(name):
"""Retrieve a service implementation
@@ -199,7 +199,7 @@
Return the default if the service can't be found.
"""
-
+
class IFactory(Interface):
@@ -238,7 +238,7 @@
def getInterfaces(name):
"""returns the interface or interface tuple that
object instances created by the named factory will implement."""
-
+
class IUtilityService(Interface):
@@ -263,7 +263,7 @@
"""The context of the object
This is the object being adapted, viewed, extemded, etc.
-
+
""")
class IAdapterService(Interface):
@@ -401,7 +401,7 @@
"stands in" for the user.
"""
-
+
class IViewService(Interface):
@@ -429,7 +429,7 @@
def getDefaultViewName(object, request):
"""Get the name of the default view for the object and request
-
+
The request must implement IPresentationRequest.
A NotFoundError will be raised if the suitable
@@ -438,7 +438,7 @@
def queryDefaultViewName(object, request, default=None):
"""Look for the name of the default view for the object and request
-
+
The request must implement IPresentationRequest.
The default will be returned if a suitable
=== Zope3/src/zope/component/resource.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/component/resource.py:1.1.2.2 Tue Dec 24 07:51:24 2002
+++ Zope3/src/zope/component/resource.py Tue Dec 24 21:20:57 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.
-#
+#
##############################################################################
"""
@@ -77,8 +77,8 @@
return factory(request)
return default
-
-
+
+
def provideResource(self, name, type, factory, layer='default'):
'''See interface IGlobalResourceService'''
@@ -93,7 +93,7 @@
reg.register(type, factory)
_clear = __init__
-
+
resourceService = GlobalResourceService()
provideResource = resourceService.provideResource
_clear = resourceService._clear
=== Zope3/src/zope/component/service.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/component/service.py:1.1.2.2 Tue Dec 24 07:51:24 2002
+++ Zope3/src/zope/component/service.py Tue Dec 24 21:20:57 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.
-#
+#
##############################################################################
"""
@@ -22,12 +22,12 @@
class IGlobalServiceManager(IServiceService):
-
+
def defineService(name, interface):
"""Define a new service of the given name implementing the given
interface. If the name already exists, raises
DuplicationError"""
-
+
def provideService(name, component):
"""Register a service component.
@@ -37,7 +37,7 @@
defined, raises UndefinedService; if the component does not
implement the registered interface for the service name,
raises InvalidService.
-
+
"""
class UndefinedService(Exception):
@@ -48,7 +48,7 @@
"""An attempt to register a service that doesn't implement
the required interface
"""
-
+
class GlobalServiceManager:
"""service manager"""
@@ -57,7 +57,7 @@
def __init__(self):
self.__defs = {}
self.__services = {}
-
+
def defineService(self, name, interface):
"""see IGlobalServiceManager interface"""
=== Zope3/src/zope/component/skin.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/component/skin.py:1.1.2.2 Tue Dec 24 07:51:24 2002
+++ Zope3/src/zope/component/skin.py Tue Dec 24 21:20:57 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.
-#
+#
##############################################################################
"""
@@ -39,7 +39,7 @@
def defineSkin(self, name, view_type, layers):
'''See interface IGlobalSkinService'''
-
+
reg = self.__skins.get(name, None)
if reg is None:
reg = self.__skins[name] = ImplementorRegistry()
@@ -58,7 +58,7 @@
return _default
_clear = __init__
-
+
skinService = GlobalSkinService()
=== Zope3/src/zope/component/utility.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/component/utility.py:1.1.2.1 Mon Dec 23 14:32:40 2002
+++ Zope3/src/zope/component/utility.py Tue Dec 24 21:20:57 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.
-#
+#
##############################################################################
"""utility service
@@ -29,9 +29,9 @@
"""
class GlobalUtilityService:
-
+
__implements__=IGlobalUtilityService
-
+
def __init__(self):
self.__utilities = {}
@@ -46,7 +46,7 @@
if registry is None:
registry = ImplementorRegistry()
self.__utilities[name] = registry
-
+
registry.register(providedInterface, component)
def getUtility(self, interface, name=''):
@@ -68,7 +68,7 @@
c = default
return c
-
+
_clear = __init__
# the global utility service instance (see component.zcml )
=== Zope3/src/zope/component/view.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/component/view.py:1.1.2.1 Mon Dec 23 14:32:40 2002
+++ Zope3/src/zope/component/view.py Tue Dec 24 21:20:57 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.
-#
+#
##############################################################################
"""
@@ -23,12 +23,12 @@
from zope.exceptions import NotFoundError
class IGlobalViewService(IViewService):
-
+
def setDefaultViewName(i_required, i_provided, name):
'''Add name to our registry of default view names for
the interfaces given.
'''
-
+
def provideView(forInterface, name, type, factory, layer='default'):
"""Register a view factory
@@ -83,8 +83,8 @@
return makers[-1](result, request)
return default
-
-
+
+
def provideView(self, forInterface, name, type, maker, layer='default'):
'''See interface IGlobalViewService'''
@@ -133,7 +133,7 @@
return self.__layers
_clear = __init__
-
+
viewService = GlobalViewService()
provideView = viewService.provideView
setDefaultViewName = viewService.setDefaultViewName