[Zope3-checkins] CVS: Zope3/src/zope/app/services/pluggableauth - __init__.py:1.7.6.1

Jim Fulton jim at zope.com
Mon Sep 8 15:22:19 EDT 2003


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

Modified Files:
      Tag: parentgeddon-branch
	__init__.py 
Log Message:
Checking in work in progress on parentgeddon-branch so Fred can help
me to get the tests passing.  Specific log entries will be provided
when we merge this into the head.


=== Zope3/src/zope/app/services/pluggableauth/__init__.py 1.7 => 1.7.6.1 ===
--- Zope3/src/zope/app/services/pluggableauth/__init__.py:1.7	Sun Aug 17 02:08:15 2003
+++ Zope3/src/zope/app/services/pluggableauth/__init__.py	Mon Sep  8 14:21:48 2003
@@ -27,8 +27,7 @@
 from zodb.btrees.OIBTree import OIBTree
 from zope.interface import implements
 from zope.component import queryAdapter
-from zope.context.wrapper import Wrapper
-from zope.context import getWrapperData
+from zope.app.container.contained import ContainedProxy
 from zope.app.services.servicenames import Authentication
 from zope.component.interfaces import IViewFactory
 from zope.app.container.ordered import OrderedContainer
@@ -44,7 +43,7 @@
 from zope.app.interfaces.services.service import ISimpleService
 from zope.app.component.nextservice import queryNextService
 from zope.app import zapi
-from zope.context import ContextMethod
+from zope.app.traversing import getPath
 from zope.exceptions import NotFoundError
 
 def gen_key():
@@ -80,8 +79,6 @@
             t = int(time.time())
             self.earmark = '%s-%s-%s' % (myname, rand_id, t)
 
-    afterAddHook = ContextMethod(afterAddHook)
-
     def authenticate(self, request):
         """ See IAuthenticationService. """
         for ps_key, ps in self.items():
@@ -91,14 +88,13 @@
                 if principal is not None:
                     id = '\t'.join((self.earmark, ps_key,
                                     str(principal.getId())))
-                    return PrincipalWrapper(principal, self, id=id)
+                    return PrincipalWrapper(principal, self, id)
 
         next = queryNextService(self, Authentication, None)
         if next is not None:
             return next.authenticate(request)
 
         return None
-    authenticate = ContextMethod(authenticate)
 
     def unauthenticatedPrincipal(self):
         """ See IAuthenticationService. """
@@ -112,7 +108,6 @@
             return next.unauthorized(id, request)
 
         return None
-    unauthorized = ContextMethod(unauthorized)
 
     def getPrincipal(self, id):
         """ See IAuthenticationService.
@@ -148,9 +143,7 @@
         if source is None:
             raise NotFoundError, principal_src_id
         p = source.getPrincipal(principal_id)
-        return PrincipalWrapper(p, self, id=id)
-
-    getPrincipal = ContextMethod(getPrincipal)
+        return PrincipalWrapper(p, self, id)
 
     def getPrincipals(self, name):
         """ See IAuthenticationService. """
@@ -158,13 +151,12 @@
         for ps_key, ps in self.items():
             for p in ps.getPrincipals(name):
                 id = '\t'.join((self.earmark, ps_key, str(p.getId())))
-                yield PrincipalWrapper(p, self, id=id)
+                yield PrincipalWrapper(p, self, id)
 
         next = queryNextService(self, Authentication, None)
         if next is not None:
             for p in next.getPrincipals(name):
                 yield p
-    getPrincipals = ContextMethod(getPrincipals)
 
     def addPrincipalSource(self, id, principal_source):
         """ See IPluggableAuthenticationService.
@@ -507,14 +499,17 @@
         return p
 
 
-class PrincipalWrapper(Wrapper):
-    """ A wrapper for a principal as returned from the authentication
+class PrincipalWrapper(ContainedProxy):
+    """Principal Wrapper
+
+    A wrapper for a principal as returned from the authentication
     service.  This wrapper returns the principal id which includes
     identification of the auth service and the principal store id in
-    addition to the principal id."""
+    addition to the principal id.
+    """
 
     def getId(self):
         """ Return the id as passed in to the wrapper """
-        return getWrapperData(self)['id']
+        return self.__name__
 
 




More information about the Zope3-Checkins mailing list