diff --git a/maloja/apis/__init__.py b/maloja/apis/__init__.py index bf20dfa..d2743e7 100644 --- a/maloja/apis/__init__.py +++ b/maloja/apis/__init__.py @@ -11,7 +11,3 @@ def init_apis(server): for api in apis: apis[api].mount(server=server,path="apis/"+api) - - # backwards compatibility - nativeapi = copy.deepcopy(apis["mlj_1"]) - nativeapi.mount(server=server,path="api") diff --git a/maloja/server.py b/maloja/server.py index 603acbf..92c834d 100755 --- a/maloja/server.py +++ b/maloja/server.py @@ -15,7 +15,7 @@ from . import malojatime from . import utilities from . import malojauri from .utilities import resolveImage -from .malojauri import uri_to_internal, remove_identical +from .malojauri import uri_to_internal, remove_identical, compose_querystring from . import globalconf from .jinjaenv.context import jinja_environment # doreah toolkit @@ -58,6 +58,24 @@ auth.authapi.mount(server=webserver) from .apis import init_apis init_apis(webserver) + + + +# redirects for backwards compatibility +@webserver.get("/api/s/") +@webserver.post("/api/s/") +def deprecated_api_s(pth): + redirect("/apis/" + pth + "?" + compose_querystring(request.query)) + +@webserver.get("/api/") +@webserver.post("/api/") +def deprecated_api(pth): + redirect("/apis/mlj_1/" + pth + "?" + compose_querystring(request.query)) + + + + + pthjoin = os.path.join def generate_css():