Пример #1
0
def get_path_to_form_config(filename, app=None, location=None):
    """Returns the path to the given form configuration. The filename
    should be realtive to the default `location` for the configurations
    in the given `app`.

    :file: Name of the form condifguration.
    :app: You can define the name of the application from where the form
    should be loaded. If no name is provied the code will search along
    the inheritance path of the current application and return the first
    form configuration it can find. Returns None if no configuration can
    be found.
    :location: Default is 'views/forms' you can define an alternative location.
    :returns: Absolute path to the configuration file

    """
    if location is None:
        location = "views/forms"
    if app is None:
        for app in get_app_inheritance_path():
            path = get_path_to(os.path.join(location, filename), app)
            if os.path.exists(path):
                return path
        return path
    else:
        return get_path_to(os.path.join(location, filename), app)
Пример #2
0
def get_path_to_form_config(filename, app=None, location=None):
    """Returns the path to the given form configuration. The filename
    should be realtive to the default `location` for the configurations
    in the given `app`.

    :file: Name of the form condifguration.
    :app: You can define the name of the application from where the form
    should be loaded. If no name is provied the code will search along
    the inheritance path of the current application and return the first
    form configuration it can find. Returns None if no configuration can
    be found.
    :location: Default is 'views/forms' you can define an alternative location.
    :returns: Absolute path to the configuration file

    """
    if location is None:
        location = "views/forms"
    if app is None:
        for app in get_app_inheritance_path():
            path = get_path_to(os.path.join(location, filename), app)
            if os.path.exists(path):
                return path
        return path
    else:
        return get_path_to(os.path.join(location, filename), app)
Пример #3
0
def get_path_to_overview_config(filename, app=None, location=None):
    """Returns the path the the given overview configuration. The file name
    should be realtive to the default location for the configurations.

    :file: filename
    :returns: Absolute path to the configuration file

    """
    if location is None:
        location = "views/tables"
    return get_path_to(os.path.join(location, filename), app)
Пример #4
0
def test_get_path_to():
    import pkg_resources
    from ringo.lib.helpers import get_path_to
    location = pkg_resources.get_distribution("ringo").location
    result = get_path_to("this/is/my/location")
    assert result == location + "/ringo/this/is/my/location"
Пример #5
0
def test_get_path_to():
    import pkg_resources
    from ringo.lib.helpers import get_path_to
    location = pkg_resources.get_distribution("ringo").location
    result = get_path_to("this/is/my/location")
    assert result == location + "/ringo/this/is/my/location"