[Zope-CVS] CVS: Products/PluggableAuthService/plugins - BasePlugin.py:1.4 ScriptablePlugin.py:1.4

Jens Vagelpohl jens at dataflake.org
Sat Nov 20 12:53:45 EST 2004


Update of /cvs-repository/Products/PluggableAuthService/plugins
In directory cvs.zope.org:/tmp/cvs-serv23501/plugins

Modified Files:
	BasePlugin.py ScriptablePlugin.py 
Log Message:
- implement _getPAS method on BasePlugin as new canonical way to get at the
  PAS instance from inside the plugin
- find and change existing plugin code that accesses the PAS instance to use
  the new method


=== Products/PluggableAuthService/plugins/BasePlugin.py 1.3 => 1.4 ===
--- Products/PluggableAuthService/plugins/BasePlugin.py:1.3	Thu Aug 12 11:15:54 2004
+++ Products/PluggableAuthService/plugins/BasePlugin.py	Sat Nov 20 12:53:44 2004
@@ -67,8 +67,8 @@
     def manage_activateInterfaces( self, interfaces, RESPONSE=None ):
         """ For ZMI update of active interfaces. """
 
-        parent = aq_parent( aq_inner( self ) )
-        plugins = parent._getOb( 'plugins' )
+        pas_instance = self._getPAS()
+        plugins = pas_instance._getOb( 'plugins' )
 
         active_interfaces = []
 
@@ -91,5 +91,10 @@
                               '?manage_tabs_message='
                               'Interface+activations+updated.'
                             % self.absolute_url())
+
+    security.declarePrivate( '_getPAS' )
+    def _getPAS( self ):
+        """ Canonical way to get at the PAS instance from a plugin """
+        return aq_parent( aq_inner( self ) )
 
 InitializeClass(BasePlugin)


=== Products/PluggableAuthService/plugins/ScriptablePlugin.py 1.3 => 1.4 ===
--- Products/PluggableAuthService/plugins/ScriptablePlugin.py:1.3	Thu Aug 12 11:15:54 2004
+++ Products/PluggableAuthService/plugins/ScriptablePlugin.py	Sat Nov 20 12:53:44 2004
@@ -18,7 +18,6 @@
 """
 from urllib import quote_plus
 from OFS.Folder import Folder
-from Acquisition import aq_parent, aq_inner
 from AccessControl import ClassSecurityInfo
 from AccessControl.Permissions import manage_users as ManageUsers
 from App.class_init import default__class_init__ as InitializeClass
@@ -99,8 +98,8 @@
             interface assertions the object might implement. 
         """
         myId = self.getId()
-        parent = aq_parent( aq_inner( self ) )
-        plugins = parent._getOb( 'plugins' )
+        pas_instance = self._getPAS()
+        plugins = pas_instance._getOb( 'plugins' )
 
         del_interfaces = filter( lambda x: id in x.names()
                                , self.__implements__ )
@@ -120,8 +119,8 @@
     def manage_updateInterfaces( self, interfaces, RESPONSE=None ):
         """ For ZMI update of interfaces. """
 
-        parent = aq_parent( aq_inner( self ) )
-        plugins = parent._getOb( 'plugins' )
+        pas_instance = self._getPAS()
+        plugins = pas_instance._getOb( 'plugins' )
 
         new_interfaces = []
 



More information about the Zope-CVS mailing list