Commit 6518fe6a by Őry Máté

check if command is a staticmethod

parent 978084f7
...@@ -20,6 +20,7 @@ from StringIO import StringIO ...@@ -20,6 +20,7 @@ from StringIO import StringIO
from base64 import decodestring from base64 import decodestring
from shutil import rmtree, move from shutil import rmtree, move
from datetime import datetime from datetime import datetime
from types import FunctionType
from utils import SerialLineReceiverBase from utils import SerialLineReceiverBase
...@@ -355,6 +356,10 @@ class SerialLineReceiver(SerialLineReceiverBase): ...@@ -355,6 +356,10 @@ class SerialLineReceiver(SerialLineReceiverBase):
except AttributeError as e: except AttributeError as e:
raise AttributeError(u'Command not found: %s (%s)' % (command, e)) raise AttributeError(u'Command not found: %s (%s)' % (command, e))
if not isinstance(func, FunctionType):
raise AttributeError("Command refers to non-static method %s." %
unicode(func))
# check for unexpected keyword arguments # check for unexpected keyword arguments
argspec = getargspec(func) argspec = getargspec(func)
if argspec.keywords is None: # _operation doesn't take ** args if argspec.keywords is None: # _operation doesn't take ** args
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment