[Zope3-checkins] CVS: Zope3/src/zope/app/services - session.py:1.11 utility.py:1.17 view.py:1.35 zpt.py:1.14

Jim Fulton jim at zope.com
Sun Sep 21 13:31:44 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app/services
In directory cvs.zope.org:/tmp/cvs-serv12774/src/zope/app/services

Modified Files:
	session.py utility.py view.py zpt.py 
Log Message:
No-longer use context wrappers.


=== Zope3/src/zope/app/services/session.py 1.10 => 1.11 ===
--- Zope3/src/zope/app/services/session.py:1.10	Sat Jun  7 01:31:59 2003
+++ Zope3/src/zope/app/services/session.py	Sun Sep 21 13:31:12 2003
@@ -32,7 +32,7 @@
 from zope.app.interfaces.services.session import ISessionService
 from zope.app.interfaces.services.session import IConfigureSessionService
 from zope.app.interfaces.services.service import ISimpleService
-
+from zope.app.container.contained import Contained
 
 cookieSafeTrans = string.maketrans("+/", "-.")
 
@@ -41,7 +41,7 @@
     return s.encode("base64")[:-2].translate(cookieSafeTrans)
 
 
-class CookieSessionService(Persistent):
+class CookieSessionService(Persistent, Contained):
     """Session service implemented using cookies."""
 
     implements(ISessionService, IConfigureSessionService, ISimpleService)


=== Zope3/src/zope/app/services/utility.py 1.16 => 1.17 ===
--- Zope3/src/zope/app/services/utility.py:1.16	Tue Aug 19 19:11:05 2003
+++ Zope3/src/zope/app/services/utility.py	Sun Sep 21 13:31:12 2003
@@ -29,11 +29,10 @@
      RegistrationStack, ComponentRegistration
 from zope.component.exceptions import ComponentLookupError
 from zope.interface.implementor import ImplementorRegistry
-from zope.context import ContextMethod
-from zope.app.context import ContextWrapper
 from zope.proxy import removeAllProxies
+from zope.app.container.contained import Contained
 
-class LocalUtilityService(Persistent):
+class LocalUtilityService(Persistent, Contained):
 
     implements(ILocalUtilityService, IRegistry, ISimpleService)
 
@@ -46,7 +45,6 @@
         if utility is None:
             raise ComponentLookupError("utility", interface, name)
         return utility
-    getUtility = ContextMethod(getUtility)
 
     def queryUtility(self, interface, default=None, name=''):
         """See zope.component.interfaces.IUtilityService"""
@@ -58,7 +56,6 @@
 
         next = getNextService(self, Utilities)
         return next.queryUtility(interface, default, name)
-    queryUtility = ContextMethod(queryUtility)
 
     def getUtilitiesFor(self, interface):
         """See zope.component.interfaces.IUtilityService"""
@@ -70,14 +67,12 @@
             if utility[0] not in names:
                 utilities.append(utility)
         return utilities
-    getUtilitiesFor = ContextMethod(getUtilitiesFor)
 
     def getLocalUtilitiesFor(self, interface):
         """See zope.app.interfaces.services.ILocalUtilityService"""
         utilities = []
         for name in self._utilities:
             for iface, cr in self._utilities[name].getRegisteredMatching():
-                cr = ContextWrapper(cr, self)
                 if not cr or cr.active() is None:
                     continue
                 utility = cr.active().getComponent()
@@ -86,7 +81,6 @@
                     continue
                 utilities.append((name, utility))
         return utilities
-    getLocalUtilitiesFor = ContextMethod(getLocalUtilitiesFor)
 
 
     def getRegisteredMatching(self, interface=None, name=None):
@@ -100,16 +94,14 @@
                     continue
                 if name is not None and reg_name.find(name) < 0:
                     continue
-                L.append((iface, reg_name, ContextWrapper(cr, self)))
+                L.append((iface, reg_name, cr))
         return L
-    getRegisteredMatching = ContextMethod(getRegisteredMatching)
 
     def queryRegistrationsFor(self, registration, default=None):
         """zope.app.interfaces.services.registration.IRegistry"""
         return self.queryRegistrations(registration.name,
                                         registration.interface,
                                         default)
-    queryRegistrationsFor = ContextMethod(queryRegistrationsFor)
 
     def queryRegistrations(self, name, interface, default=None):
         """zope.app.interfaces.services.registration.IRegistry"""
@@ -120,15 +112,13 @@
         if stack is None:
             return default
 
-        return ContextWrapper(stack, self)
-    queryRegistrations = ContextMethod(queryRegistrations)
+        return stack
 
     def createRegistrationsFor(self, registration):
         """zope.app.interfaces.services.registration.IRegistry"""
         return self.createRegistrations(registration.name,
                                          registration.interface)
 
-    createRegistrationsFor = ContextMethod(createRegistrationsFor)
 
     def createRegistrations(self, name, interface):
         """zope.app.interfaces.services.registration.IRegistry"""
@@ -139,11 +129,10 @@
 
         stack = utilities.getRegistered(interface)
         if stack is None:
-            stack = RegistrationStack()
+            stack = RegistrationStack(self)
             utilities.register(interface, stack)
 
-        return ContextWrapper(stack, self)
-    createRegistrations = ContextMethod(createRegistrations)
+        return stack
 
 
 class UtilityRegistration(ComponentRegistration):


=== Zope3/src/zope/app/services/view.py 1.34 => 1.35 ===
--- Zope3/src/zope/app/services/view.py:1.34	Wed Aug 20 14:21:12 2003
+++ Zope3/src/zope/app/services/view.py	Sun Sep 21 13:31:12 2003
@@ -49,8 +49,9 @@
 from zope.app.services.adapter import PersistentAdapterRegistry
 from zope.configuration.exceptions import ConfigurationError
 from zope.app.interfaces.services.service import ISimpleService
+from zope.app.container.contained import Contained
 
-class ViewService(Persistent):
+class ViewService(Persistent, Contained):
 
     implements(IViewService, ILocalViewService, IRegistry, ISimpleService,
                IInterfaceBasedRegistry)
@@ -58,9 +59,6 @@
     def __init__(self):
         self._layers = PersistentDict()
 
-    # All the methods defined here are context methods
-    zapi.ContextAwareDescriptors()
-
     def queryRegistrationsFor(self, registration, default=None):
         "See IRegistry"
         return self.queryRegistrations(
@@ -85,7 +83,7 @@
         if registry is None:
             return default
 
-        return zapi.ContextWrapper(registry, self)
+        return registry
 
     def createRegistrationsFor(self, registration):
         "See IRegistry"
@@ -110,10 +108,10 @@
             forInterface, presentationType)
 
         if registry is None:
-            registry = RegistrationStack()
+            registry = RegistrationStack(self)
             adapter_registry.register(forInterface, presentationType, registry)
 
-        return zapi.ContextWrapper(registry, self)
+        return registry
 
     def getView(self, object, name, request):
         view = self.queryView(object, name, request)
@@ -137,14 +135,12 @@
 
             registry = reg.getForObject(
                 object, type,
-                filter = lambda registry:
-                         zapi.ContextWrapper(registry, self).active(),
+                filter = lambda registry: registry.active(),
                 )
 
             if registry is None:
                 continue
 
-            registry = zapi.ContextWrapper(registry, self)
             view = registry.active().getView(object, request)
             return view
 
@@ -206,7 +202,7 @@
     def getRegistrationsForInterface(self, iface):
         for t in self.getRegisteredMatching(required_interfaces=[iface]):
             # XXX getRegisteredMatching ought to return a wrapped object
-            reg = zapi.ContextWrapper(t[2], self) # t[2] is registration stack
+            reg = t[2]
             for info in reg.info():
                 yield info["registration"]
 
@@ -285,11 +281,10 @@
         self.permission = permission
 
     def getView(self, object, request):
-        folder = zapi.getWrapperContainer(zapi.getWrapperContainer(self))
+        folder = self.__parent__.__parent__
         factory = folder.resolve(self.class_)
         return factory(object, request)
 
-    getView = zapi.ContextMethod(getView)
 
     def usageSummary(self):
         if self.forInterface is None:
@@ -377,7 +372,7 @@
         sm = zapi.getServiceManager(self)
 
         if self.class_:
-            folder = zapi.getWrapperContainer(zapi.getWrapperContainer(self))
+            folder = self.__parent__.__parent__
             class_ = folder.resolve(self.class_)
             class_ = type(class_.__name__, (class_, DefaultClass), {})
         else:
@@ -398,7 +393,6 @@
 
         return ProxyFactory(template, checker)
 
-    getView = zapi.ContextMethod(getView)
 
 class DefaultClass:
 


=== Zope3/src/zope/app/services/zpt.py 1.13 => 1.14 ===
--- Zope3/src/zope/app/services/zpt.py:1.13	Sat Jun  7 01:31:59 2003
+++ Zope3/src/zope/app/services/zpt.py	Sun Sep 21 13:31:12 2003
@@ -28,8 +28,9 @@
 from zope.app.interfaces.file import IReadFile, IWriteFile, IFileFactory
 from zope.app.fssync.classes import ObjectEntryAdapter, AttrMapping
 from zope.app.interfaces.fssync import IObjectFile
+from zope.app.container.contained import Contained
 
-class ZPTTemplate(AppPT, PageTemplate, Persistent):
+class ZPTTemplate(AppPT, PageTemplate, Persistent, Contained):
 
     implements(IZPTTemplate)
 




More information about the Zope3-Checkins mailing list