modulecore.py

changeset 149
1759c15cd0ca
parent 146
c17b82b1f573
child 154
df862cca1773
--- a/modulecore.py	Sat Aug 08 14:17:06 2015 +0300
+++ b/modulecore.py	Sat Aug 08 14:17:30 2015 +0300
@@ -180,12 +180,16 @@
 def exec_command (commandObject):
 	global g_lastConfirm
 	global g_confirmCommand
-	cmdname = commandObject['cmdname']
 
-	try:
-		func = getattr (commandObject['module'], 'cmd_' + cmdname)
-	except AttributeError:
-		command_error ('''command '%s' does not have a definition''' % cmdname)
+	if 'function' in commandObject:
+		func = commandObject['function']
+	else:
+		cmdname = commandObject['cmdname']
+
+		try:
+			func = getattr (commandObject['module'], 'cmd_' + cmdname)
+		except AttributeError:
+			command_error ('''command '%s' does not have a definition''' % cmdname)
 
 	try:
 		func (**commandObject)

mercurial