Jason Tackaberry wrote: > On Sun, 2008-03-16 at 16:37 +0100, Duncan Webb wrote: >> Log: >> Put back the 17 calls, some of the functions return tuples and others don't > > I don't see why this is a problem. It's just more abstraction you want > to add to _rpc_wait. Another argument that defines the default return > value if the inprogress is None:
It's not that that is the problem, it is the return values from the wait, sometimes it is just the result and sometime a tuple. First, I want to fix the outstanding bug that Justin is having a problem and the other outstanding bugs without having to test everything again. It is quite/very time consuming testing the recordserver. > def _rpc_wait(self, rpc_name, default, *args): > inprogress = self._recordserver_rpc(rpc_name, *args) > if inprogress is None: > return default > result = inprogress.wait() > _debug_('%s.result=%r' % (rpc_name, result), 1) > return result > > >> + inprogress = self._recordserver_rpc('ping') >> + if inprogress is None: >> return False >> + inprogress.wait() >> + result = inprogress.get_result() >> + _debug_('pingNow.result=%r' % (result,), 1) >> return result > > All this becomes: > > return self._rpc_wait('ping', False) > >> + inprogress = self._recordserver_rpc('findNextProgram', isrecording) >> + if inprogress is None: >> + return None >> + inprogress.wait() >> + result = inprogress.get_result() >> + _debug_('findNextProgramNow.result=%r' % (result,), 1) >> + return result > > Becomes: > > return self._rpc_wait('findNextProgram', None, isrecording) > >> + inprogress = self._recordserver_rpc('getScheduledRecordings') >> + if inprogress is None: >> + return (None, self.recordserverdown) >> + inprogress.wait() >> + result = inprogress.get_result() >> + _debug_('getScheduledRecordingsNow.result=%r' % (result,), 1) >> + return (True, result) > > Becomes: > > return self._rpc_wait('getScheduledRecordings', (None, > self.recordserverdown)) > > Etc. This is a nice solution, but misses: return (True, result) return result It's on my to do list to do this correctly, basically I could have two methods one for the tuples and one for the objects. Cheers, Duncan ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Freevo-devel mailing list Freevo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freevo-devel