[Zope3-checkins] SVN: Zope3/branches/dominik-locatableadapters/src/zope/app/component/ change subsriber directive too.

Dominik Huber dominik.huber at projekt01.ch
Wed Apr 20 10:53:41 EDT 2005


Log message for revision 30060:
  change subsriber directive too.

Changed:
  U   Zope3/branches/dominik-locatableadapters/src/zope/app/component/metaconfigure.py
  U   Zope3/branches/dominik-locatableadapters/src/zope/app/component/tests/test_directives.py

-=-
Modified: Zope3/branches/dominik-locatableadapters/src/zope/app/component/metaconfigure.py
===================================================================
--- Zope3/branches/dominik-locatableadapters/src/zope/app/component/metaconfigure.py	2005-04-20 13:55:54 UTC (rev 30059)
+++ Zope3/branches/dominik-locatableadapters/src/zope/app/component/metaconfigure.py	2005-04-20 14:53:41 UTC (rev 30060)
@@ -31,7 +31,6 @@
 from zope.app import zapi
 from zope.app.security.adapter import LocatingTrustedAdapterFactory
 from zope.app.security.adapter import LocatingUntrustedAdapterFactory
-from zope.app.security.adapter import TrustedAdapterFactory
 
 PublicPermission = 'zope.Public'
 
@@ -113,9 +112,15 @@
                 ob = f(ob)
             return ob
 
+    # invoke custom adapter factories
     if trusted:
-        factory = TrustedAdapterFactory(factory)
+        # trusted adapters that requires dedicated permission all the time
+        factory = LocatingTrustedAdapterFactory(factory)
 
+    elif permission is not None and permission is not CheckerPublic:
+        # untrusted adapters that requires any dedicated permission
+        factory = LocatingUntrustedAdapterFactory(factory) 
+
     _context.action(
         discriminator = None,
         callable = _handler,

Modified: Zope3/branches/dominik-locatableadapters/src/zope/app/component/tests/test_directives.py
===================================================================
--- Zope3/branches/dominik-locatableadapters/src/zope/app/component/tests/test_directives.py	2005-04-20 13:55:54 UTC (rev 30059)
+++ Zope3/branches/dominik-locatableadapters/src/zope/app/component/tests/test_directives.py	2005-04-20 14:53:41 UTC (rev 30060)
@@ -184,8 +184,8 @@
               />
             '''
             )))
-
-        # With an unproxied object, business as usual
+        # The adapter is location-proxied
+        # With an unproxied object
         content = Content()
         a1 = A1()
         subscribers = zapi.subscribers((content, a1), IS)
@@ -193,6 +193,7 @@
         a3 = subscribers[0]
 
         self.assertEqual(a3.__class__, A3)
+        self.assertEqual(type(a3).__name__, 'LocationProxy')
         self.assertEqual(a3.context, (content, a1))
 
         # Now with a proxied object:
@@ -208,6 +209,7 @@
         # around an unproxied object:
         from zope.security.proxy import removeSecurityProxy
         self.assert_(removeSecurityProxy(a3).context[0] is content)
+        self.assertEqual(type(removeSecurityProxy(a3)).__name__, 'LocationProxy')
 
     def testSubscriber_w_no_provides(self):
         xmlconfig(StringIO(template % (



More information about the Zope3-Checkins mailing list