def get_profile_configs(profile=None, use_cache=True):
    """
    Returns upload configs for profile.
    """
    if use_cache and profile in _profile_configs_cache:
        return _profile_configs_cache[profile]
    profile_conf = None
    if profile is not None:
        try:
            profile_conf = dju_settings.DJU_IMG_UPLOAD_PROFILES[profile]
        except KeyError:
            if profile != 'default':
                raise ValueError(unicode(ERROR_MESSAGES['unknown_profile']) % {'profile': profile})
    conf = copy.deepcopy(dju_settings.DJU_IMG_UPLOAD_PROFILE_DEFAULT)
    if profile_conf:
        conf.update(copy.deepcopy(profile_conf))
        for v_i in xrange(len(conf['VARIANTS'])):
            v = conf['VARIANTS'][v_i]
            conf['VARIANTS'][v_i] = copy.deepcopy(dju_settings.DJU_IMG_UPLOAD_PROFILE_VARIANT_DEFAULT)
            conf['VARIANTS'][v_i].update(v)
    if use_cache:
        _profile_configs_cache[profile] = conf
    return conf
def get_profile_configs ( profile = None , use_cache = True ) : if use_cache and profile in _profile_configs_cache : return _profile_configs_cache [ profile ] profile_conf = None if profile is not None : try : profile_conf = dju_settings . DJU_IMG_UPLOAD_PROFILES [ profile ] except KeyError : if profile != 'default' : raise ValueError ( unicode ( ERROR_MESSAGES [ 'unknown_profile' ] ) % { 'profile' : profile } ) conf = copy . deepcopy ( dju_settings . DJU_IMG_UPLOAD_PROFILE_DEFAULT ) if profile_conf : conf . update ( copy . deepcopy ( profile_conf ) ) for v_i in xrange ( len ( conf [ 'VARIANTS' ] ) ) : v = conf [ 'VARIANTS' ] [ v_i ] conf [ 'VARIANTS' ] [ v_i ] = copy . deepcopy ( dju_settings . DJU_IMG_UPLOAD_PROFILE_VARIANT_DEFAULT ) conf [ 'VARIANTS' ] [ v_i ] . update ( v ) if use_cache : _profile_configs_cache [ profile ] = conf return conf
Returns upload configs for profile.