Esempio n. 1
0
def ppk(pool=None, include=None):
    app = Bottle()
    app.pool = pool or _ppk.Pool()

    if isinstance(include, str):
        app.pool.include(include)

    @app.get('/<path:path>')
    def get(path):
        data = app.pool['f:' + path]
        if not data: return bottle.HTTPError(404)
        bottle.response.content_type = mimetypes.guess_type(path)[0]
        return data

    return app