X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethod.py;h=53d1530472e3f9ac1003179f84aa085c91e6f1b1;hb=6bef7b35eec76ff66332cb20f58eb7703c2116f9;hp=836eea0148c394da36f0c5d18f95bf73ba32cb90;hpb=2262dad38e7699a98c3df2a8c0de3ccf3d6e6373;p=plcapi.git diff --git a/PLC/Method.py b/PLC/Method.py index 836eea0..53d1530 100644 --- a/PLC/Method.py +++ b/PLC/Method.py @@ -298,14 +298,16 @@ class Method: """ # If any of a number of types is acceptable - if isinstance(expected, Mixed): + # try them one by one, if one succeeds then it's fine + if expected and isinstance(expected, Mixed): + to_raise = None for item in expected: try: self.type_check(name, value, item, args) return except PLCInvalidArgument as fault: - pass - raise fault + to_raise = fault + raise to_raise # If an authentication structure is expected, save it and # authenticate after basic type checking is done. @@ -338,7 +340,7 @@ class Method: # Integers and long integers are also special types. Accept # either int or long types if an int or long is expected. - elif expected_type is int and isinstance(value, int): + elif expected_type is int and isinstance(value, int): pass elif not isinstance(value, expected_type):