Example #1
0
    def test_withTwo( self ):

        parent = Folder()
        parent._setObject( 'plugins', DummyPluginRegistry() )

        scriptable_plugin = self._makeOne().__of__(parent)

        faux_method = SimpleItem( 'faux_method' )
        two_method = SimpleItem( 'two_method' )

        scriptable_plugin._setObject( 'faux_method', faux_method )
        scriptable_plugin._setObject( 'two_method', two_method )

        scriptable_plugin.manage_updateInterfaces( ['IFaux', 'IFauxTwo'] )

        self.assertTrue( IFaux in providedBy(scriptable_plugin) )
        self.assertTrue( IFauxTwo in providedBy(scriptable_plugin) )
Example #2
0
    def listInterfaces( self ):
        """ For ZMI update of interfaces. """

        results = []

        for iface in flattenInterfaces( providedBy( self ) ):
            results.append( iface.__name__ )

        return results
Example #3
0
    def test_withTwoMinusOne(self):

        parent = Folder()
        parent._setObject('plugins', DummyPluginRegistry())

        scriptable_plugin = self._makeOne().__of__(parent)

        faux_method = SimpleItem('faux_method')
        two_method = SimpleItem('two_method')

        scriptable_plugin._setObject('faux_method', faux_method)
        scriptable_plugin._setObject('two_method', two_method)

        scriptable_plugin.manage_updateInterfaces(['IFaux', 'IFauxTwo'])

        scriptable_plugin._delObject('two_method')

        self.assertTrue(IFaux in providedBy(scriptable_plugin))
        self.assertFalse(IFauxTwo in providedBy(scriptable_plugin))
Example #4
0
    def _delOb( self, id ):
        """
            Override ObjectManager's _delOb to account for removing any
            interface assertions the object might implement.
        """
        myId = self.getId()
        pas_instance = self._getPAS()
        plugins = pas_instance._getOb( 'plugins' )
        curr_interfaces = Set(providedBy(self))

        del_interfaces = Set([x for x in providedBy(self) if id in x.names()])

        for interface in del_interfaces:
            if myId in plugins.listPluginIds( interface ):
                plugins.deactivatePlugin( interface, myId )

        delattr( self, id )

        directlyProvides( self, *(list(curr_interfaces - del_interfaces)) )
Example #5
0
    def test_withTwoOnlyOneWired( self ):

        parent = Folder()
        parent._setObject( 'plugins', DummyPluginRegistry() )

        scriptable_plugin = self._makeOne().__of__(parent)

        faux_method = SimpleItem( 'faux_method' )
        whatever = SimpleItem( 'whatever' )

        scriptable_plugin._setObject( 'faux_method', faux_method )
        scriptable_plugin._setObject( 'whatever', whatever )

        scriptable_plugin.manage_updateInterfaces( ['IFaux',] )

        self.failUnless( IFaux in providedBy(scriptable_plugin) )
Example #6
0
    def test_empty( self ):

        scriptable_plugin = self._makeOne()
        self.assertFalse( IFaux in providedBy(scriptable_plugin) )
        self.assertFalse( IFauxTwo in providedBy(scriptable_plugin) )
Example #7
0
    def test_empty(self):

        scriptable_plugin = self._makeOne()
        self.assertFalse(IFaux in providedBy(scriptable_plugin))
        self.assertFalse(IFauxTwo in providedBy(scriptable_plugin))
Example #8
0
    def test_empty( self ):

        scriptable_plugin = self._makeOne()
        self.failIf( IFaux in providedBy(scriptable_plugin) )
        self.failIf( IFauxTwo in providedBy(scriptable_plugin) )