From 643d4cfa8e949d3ae684b3b46dee3949a71c9f23 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Thu, 21 Jul 2011 18:20:42 +0200 Subject: [PATCH] proxy: Make sure root pages get the right theme. Previously, a theme prefix of /Site/ would not match /Site. This is now fixed. --- plugin/theme/proxy.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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)) -- 2.30.2