def _inner(self): ''' Queries an object for another interface. @return: An object with the desired interface @rtype: object @raise NotImplementedError: When the desired interface is not supported ''' iid = utils.getInterfaceIID(interface) try: i = self._icache[iid] except KeyError: # interface not cached caching = True except AttributeError: # determine if we're caching caching = _CACHE_LEVEL is not None if caching: # initialize the cache self._icache = {} else: # check if our cached result was an interface, or an indicator that the # interface is not supported if i is None: raise NotImplementedError else: return i try: # do the query remotely i = self.queryInterface(iid) if i is not None: i = i._narrow(interface) except Exception, e: raise LookupError(e)
def queryInterface(self, repo_id): ''' Reports that this class only implements the AT-SPI DeviceEventListener interface. Required by AT-SPI. @param repo_id: Request for an interface @type repo_id: string @return: The underlying CORBA object for the device event listener @rtype: Accessibility.EventListener ''' if repo_id == utils.getInterfaceIID(Accessibility.EventListener): return self._this() else: return None