don't allow instance=None for wrapper objects

This commit is contained in:
c-holtermann 2020-04-02 23:41:35 +02:00
parent 0da6b851b0
commit daff201ffb

View File

@ -59,12 +59,15 @@ class ClassFromFunctions(object):
self._module[self._new_instance] or using existing instance self._module[self._new_instance] or using existing instance
data. (specified with the keyword argument, instance) data. (specified with the keyword argument, instance)
if instance argument is None it will be ignored and the
constructor will be called to get a new instance
Pass the arguments that should be passed on to Pass the arguments that should be passed on to
self._module[self._new_instance] . Any arguments of that self._module[self._new_instance]. Any arguments of that
are instances of ClassFromFunctions will be switched with the instance are instances of ClassFromFunctions will be switched with the instance
data. (by calling the .instance property) data. (by calling the .instance property)
""" """
if INSTANCE_ARGUMENT in kargs: if INSTANCE_ARGUMENT in kargs and kargs[INSTANCE_ARGUMENT] is not None:
self.__instance = kargs[INSTANCE_ARGUMENT] self.__instance = kargs[INSTANCE_ARGUMENT]
else: else:
self.__instance = getattr(self._module, self._new_instance)( self.__instance = getattr(self._module, self._new_instance)(