From: Matthijs Kooijman Date: Thu, 21 Jul 2011 16:20:42 +0000 (+0200) Subject: proxy: Make sure root pages get the right theme. X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fprojects%2Fwipi.git;a=commitdiff_plain;h=HEAD proxy: Make sure root pages get the right theme. Previously, a theme prefix of /Site/ would not match /Site. This is now fixed. --- 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))