예제 #1
0
def set_paths(new_paths):
    """
    Override the existing app path settings.
    """
    global cache
    cache = {}
    if is_iterable(new_paths):
        global paths
        paths = new_paths
    else:
        raise TypeError("Argument to set_app_paths must be iterable")
예제 #2
0
def add_path(path, top=True):
    """
    Add a new location to the app paths.
    if top is true, the new path will be given the 
    highest priority and therefore betried before all the
    existing paths. Otherwise, it will be given the 
    lowest priority
    """
    if top:
        # only need to flush cache if higher priority than existing
        global cache
        cache = {}
    global paths
    if is_iterable(path):
        if top:
            paths = list(path) + paths
        else:
            paths.extend(path)
    else:
        if top:
            paths.insert(0, path)
        else:
            paths.append(path)