(func, event_data)
return func
Converts a model's property name, method name or a path to a callable into a callable.
            If func is not a string it will be returned unaltered.
        Args:
            func (str or callable): Property name, method name or a path to a callable
            event_data (EventData): Currently processed event
        Returns:
            callable function resolved from string or func
Converts a model's property name, method name or a path to a callable into a callable.
            If func is not a string it will be returned unaltered.
        Args:
            func (str or callable): Property name, method name or a path to a callable
            event_data (EventData): Currently processed event
        Returns:
            callable function resolved from string or func
Converts a model s property name method name or a path to a callable into a callable . If func is not a string it will be returned unaltered . Args : func ( str or callable ) : Property name method name or a path to a callable event_data ( EventData ) : Currently processed event Returns : callable function resolved from string or func
def resolve_callable(func, event_data):
        """ Converts a model's property name, method name or a path to a callable into a callable.
            If func is not a string it will be returned unaltered.
        Args:
            func (str or callable): Property name, method name or a path to a callable
            event_data (EventData): Currently processed event
        Returns:
            callable function resolved from string or func
        """
        if isinstance(func, string_types):
            try:
                func = getattr(event_data.model, func)
                if not callable(func):  # if a property or some other not callable attribute was passed
                    def func_wrapper(*_, **__):  # properties cannot process parameters
                        return func
                    return func_wrapper
            except AttributeError:
                try:
                    mod, name = func.rsplit('.', 1)
                    m = __import__(mod)
                    for n in mod.split('.')[1:]:
                        m = getattr(m, n)
                    func = getattr(m, name)
                except (ImportError, AttributeError, ValueError):
                    raise AttributeError("Callable with name '%s' could neither be retrieved from the passed "
                                         "model nor imported from a module." % func)
        return func
def resolve_callable ( func , event_data ) : if isinstance ( func , string_types ) : try : func = getattr ( event_data . model , func ) if not callable ( func ) : # if a property or some other not callable attribute was passed def func_wrapper ( * _ , * * __ ) : # properties cannot process parameters return func return func_wrapper except AttributeError : try : mod , name = func . rsplit ( '.' , 1 ) m = __import__ ( mod ) for n in mod . split ( '.' ) [ 1 : ] : m = getattr ( m , n ) func = getattr ( m , name ) except ( ImportError , AttributeError , ValueError ) : raise AttributeError ( "Callable with name '%s' could neither be retrieved from the passed " "model nor imported from a module." % func ) return func