summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2011-10-02 04:05:50 +0200
committerhut <hut@lavabit.com>2011-10-02 04:05:50 +0200
commitfd24310233f24fe164343ab44171172543f40cd5 (patch)
treebabaea39964f9fc8fab3f8ab028372d29baf96df
parentb1a7fc1cc2b5b19ecf603b31ce23574f3ecf4657 (diff)
downloadranger-fd24310233f24fe164343ab44171172543f40cd5.tar.gz
api.commands: fixed narg stuff
-rw-r--r--ranger/api/commands.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/ranger/api/commands.py b/ranger/api/commands.py
index 9d2e60e9..4ea6ad1c 100644
--- a/ranger/api/commands.py
+++ b/ranger/api/commands.py
@@ -294,12 +294,15 @@ class FunctionCommand(Command):
 			keywords['narg'] = self.quantifier
 
 		try:
-			return self._based_function(*args, **keywords)
-		except TypeError:
-			try:
-				del keywords['narg']
+			if self.quantifier is None:
 				return self._based_function(*args, **keywords)
-			except TypeError:
-				self.fm.notify("Bad arguments for %s.%s: %s, %s" %
-						(self._object_name, self._function_name,
-							repr(args), repr(keywords)), bad=True)
+			else:
+				try:
+					return self._based_function(*args, **keywords)
+				except TypeError:
+					del keywords['narg']
+					return self._based_function(*args, **keywords)
+		except TypeError:
+			self.fm.notify("Bad arguments for %s.%s: %s, %s" %
+					(self._object_name, self._function_name,
+						repr(args), repr(keywords)), bad=True)