

def rebase(base):
    ' Create new app using current app routes prefixed with base'
    if (not base):
        return bottle.app()
    oldApp = bottle.app.pop()
    newApp = bottle.app.push()
    for route in oldApp.routes:
        route.rule = '{0}{1}'.format(base, route.rule)
        newApp.add_route(oldApp)
        route.reset()
    return newApp

dataset/ETHPy150Open saltstack/halite/halite/server_bottle.py rebase/VarMisuse@76/111 `route`->`oldApp`