X-Git-Url: http://git.onelab.eu/?p=sfa.git;a=blobdiff_plain;f=sfa%2Fmanagers%2Fmanagerwrapper.py;h=326b6b63147b7a1409cf06dc6a7c45273ec133f9;hp=77af9bf6fdc89b436b3d84ac0b43f3781235b0e7;hb=4a9e6751f9f396f463932133b9d62fc925a99ef6;hpb=648ac3fd865ea29425485f26eb0a7bf1a62281e0 diff --git a/sfa/managers/managerwrapper.py b/sfa/managers/managerwrapper.py index 77af9bf6..326b6b63 100644 --- a/sfa/managers/managerwrapper.py +++ b/sfa/managers/managerwrapper.py @@ -1,4 +1,4 @@ -from types import ModuleType, ClassType +from types import ModuleType from sfa.util.faults import SfaNotImplemented, SfaAPIError from sfa.util.sfalogging import logger @@ -9,20 +9,21 @@ from sfa.util.sfalogging import logger class ManagerWrapper: """ This class acts as a wrapper around an SFA interface manager module, but - can be used with any python module. The purpose of this class is raise a - SfaNotImplemented exception if someone attempts to use an attribute + can be used with any python module. The purpose of this class is raise a + SfaNotImplemented exception if someone attempts to use an attribute (could be a callable) thats not available in the library by checking the - library using hasattr. This helps to communicate better errors messages - to the users and developers in the event that a specifiec operation + library using hasattr. This helps to communicate better errors messages + to the users and developers in the event that a specifiec operation is not implemented by a libarary and will generally be more helpful than - the standard AttributeError + the standard AttributeError """ def __init__(self, manager, interface, config): if isinstance(manager, ModuleType): # old-fashioned module implementation self.manager = manager - elif isinstance(manager, ClassType): + # if it's a class + elif isinstance(manager, type): # create an instance; we don't pass the api in argument as it is passed # to the actual method calls anyway self.manager = manager(config)