Exemple #1
0
def _get_storage_units(category_name, value_name):
    # We may specify a storage unit separately from display units
    # We do this for area, since GEOS returns m² but we want to display ft²
    # If there are no storage units specified, use the display units
    storage_defaults = DotDict(settings.STORAGE_UNITS)
    return storage_defaults.get(
        category_name + '.' + value_name,
        default=_get_display_default(category_name, value_name, 'units'))
Exemple #2
0
def _get_storage_units(category_name, value_name):
    # We may specify a storage unit separately from display units
    # We do this for area, since GEOS returns m² but we want to display ft²
    # If there are no storage units specified, use the display units
    storage_defaults = DotDict(settings.STORAGE_UNITS)
    return storage_defaults.get(category_name + '.' + value_name,
                                default=_get_display_default(
                                    category_name, value_name, 'units'))
def remove_from_config(config, *categories):
    config = DotDict(deepcopy(config or {}))
    for category in categories:
        lookup = '.'.join(['search_config', category])
        specs = config.get(lookup)
        if specs:
            find_index = [i for i, s in enumerate(specs)
                          if identifier in s.values()]
            if 0 < len(find_index):
                specs.pop(find_index[0])

    return config
Exemple #4
0
def remove_from_config(config, *categories):
    config = DotDict(deepcopy(config or {}))
    for category in categories:
        lookup = '.'.join(['search_config', category])
        specs = config.get(lookup)
        if specs:
            find_index = [
                i for i, s in enumerate(specs) if identifier in s.values()
            ]
            if 0 < len(find_index):
                specs.pop(find_index[0])

    return config