[Pkg-mpd-commits] [python-mpd] 54/262: mpd.py: tidying up _execute()

Simon McVittie smcv at debian.org
Sun May 22 18:16:24 UTC 2016


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch upstream
in repository python-mpd.

commit 461fe7b8248ef8e26f3c6119a70ef8f0336d033b
Author: J. Alexander Treuman <jat at spatialrift.net>
Date:   Thu Jul 15 13:34:44 2010 -0400

    mpd.py: tidying up _execute()
---
 mpd.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/mpd.py b/mpd.py
index 2875f95..cb16701 100644
--- a/mpd.py
+++ b/mpd.py
@@ -174,14 +174,17 @@ class MPDClient(object):
             raise PendingCommandError("Cannot execute %s with "
                                       "pending commands" % command)
         retval = self._commands[command]
-        if self._command_list is not None and not callable(retval):
-            raise CommandListError("%s not allowed in command list" % command)
-        self._write_command(command, args)
-        if self._command_list is None:
+        if self._command_list is not None:
+            if not callable(retval):
+                raise CommandListError("%s not allowed in command list" %
+                                        command)
+            self._write_command(command, args)
+            self._command_list.append(retval)
+        else:
+            self._write_command(command, args)
             if callable(retval):
                 return retval()
             return retval
-        self._command_list.append(retval)
 
     def _write_line(self, line):
         self._wfile.write("%s\n" % line)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mpd/python-mpd.git



More information about the Pkg-mpd-commits mailing list