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:
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 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-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog