X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fprojects%2Fwipi.git;a=blobdiff_plain;f=plugin%2Ftheme%2Fproxy.py;fp=plugin%2Ftheme%2Fproxy.py;h=8aa3a24092ce9a5abfc9e6917e8c76e7b5057bc5;hp=58e4ab2d89fb47f7059603bbb43356f8b3459d36;hb=643d4cfa8e949d3ae684b3b46dee3949a71c9f23;hpb=6143b643c63de8726c8858466aafe6b0b56546bf diff --git a/plugin/theme/proxy.py b/plugin/theme/proxy.py index 58e4ab2..8aa3a24 100644 --- a/plugin/theme/proxy.py +++ b/plugin/theme/proxy.py @@ -33,8 +33,14 @@ def Theme(context): called. Instead, we define a Theme function that calls the proper constructor. """ + path = context.request.path + # Always add a trailing space, so that a /Foo/ also matches the /Foo + # path (without needing to remove the trailing space from the + # prefix, which would make also match /FooBar). + if path[-1] != '/': + path += '/' for (prefix, theme) in context.cfg.proxy_theme_mapping: - if context.request.path.startswith(prefix): + if path.startswith(prefix): return load_theme(context, theme) raise ThemeNotFound("proxy_theme_mapping defines no theme for url: %s" % (context.request.path))