def __init__(self, data=None, rdio_id=None, rdio=None, extras='', timeout=None): if rdio is None: rdio = globalRdio() if data == None: if rdio_id is None: raise ValueError('data or rdio_id must not be None') try: # NOTE: The fact that I'm (disgracefully) calling a ResolverObject method from within _RdioObject's # __init__ means that all subclassers must first init ResolverObject or a subclass before initing # _RdioObject. self.countLookupCall('main data') data = rdio.method('get', keys=rdio_id, extras=extras, timeout=timeout)['result'][rdio_id] except KeyError: raise ValueError('bad rdio_id') elif rdio_id is not None: if rdio_id != data['key']: raise ValueError('rdio_id does not match data["key"]') self.__rdio = rdio self.__data = data
def __rdio(self): return globalRdio()