def settings_view_decorator(function):
    """Insert decorator from settings, if any.

    .. note:: Decorator in ``CLOUD_BROWSER_VIEW_DECORATOR`` can be either a
        callable or a fully-qualified string path (the latter, which we'll
        lazy import).
    """

    dec = settings.CLOUD_BROWSER_VIEW_DECORATOR

    # Trade-up string to real decorator.
    if isinstance(dec, str):
        # Split into module and decorator strings.
        mod_str, _, dec_str = dec.rpartition('.')
        if not (mod_str and dec_str):
            raise ImportError("Unable to import module: %s" % mod_str)

        # Import and try to get decorator function.
        mod = import_module(mod_str)
        if not hasattr(mod, dec_str):
            raise ImportError("Unable to import decorator: %s" % dec)

        dec = getattr(mod, dec_str)

    if dec and callable(dec):
        return dec(function)

    return function
def settings_view_decorator ( function ) : dec = settings . CLOUD_BROWSER_VIEW_DECORATOR if isinstance ( dec , str ) : mod_str , _ , dec_str = dec . rpartition ( '.' ) if not ( mod_str and dec_str ) : raise ImportError ( "Unable to import module: %s" % mod_str ) mod = import_module ( mod_str ) if not hasattr ( mod , dec_str ) : raise ImportError ( "Unable to import decorator: %s" % dec ) dec = getattr ( mod , dec_str ) if dec and callable ( dec ) : return dec ( function ) return function
Insert decorator from settings, if any.

    .. note:: Decorator in ``CLOUD_BROWSER_VIEW_DECORATOR`` can be either a
        callable or a fully-qualified string path (the latter, which we'll
        lazy import).