def createStaticMain(kind='bottle',
                     moldPath=MOLD_DIR_PATH,
                     base="",
                     devel=False,
                     coffee=False,
                     save=False,
                     path=os.path.join(STATIC_APP_PATH, 'main.html')):
    """
    Generate and return main.html using template filepath mold and optionally
    write to filepath path is save

    """
    import bottle

    data = dict(baseUrl=base,
                mini=".min" if not devel else "",
                coffee = coffee )

    #get lists of app scripts and styles filenames
    scripts, sheets = aiding.getFiles( top=STATIC_APP_PATH,
                                       prefix='',
                                       coffee = coffee)
    data['scripts'] = scripts
    data['sheets'] = sheets

    content =  ''
    mainMoldPath = os.path.join(moldPath, 'main_{0}.html'.format(kind))
    with open(mainMoldPath, "r") as fp:
        mold = fp.read()
        if kind == 'bottle':
            content = bottle.SimpleTemplate(mold).render(**data)
        #elif kind == 'mustache':
            #content = staching.render(mold, data)

    if content and save:
        with open(path, 'w+') as fp:
            fp.write(content)

    return content
dataset/ETHPy150Open saltstack/halite/halite/server_bottle.py/createStaticMain/original