From 5f4b80e5a1508116271ae8a6087834fff8ee3825 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 29 Jun 2009 10:18:10 +0000 Subject: - Use ``caller_package`` function instead of ``caller_module`` function within ``templating`` to avoid needing to name the caller module in resource overrides (actually match docs). - Make it possible to override templates stored directly in a module with templates in a subdirectory of the same module, stored directly within another module, or stored in a subdirectory of another module (actually match docs). --- repoze/bfg/zcml.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'repoze/bfg/zcml.py') diff --git a/repoze/bfg/zcml.py b/repoze/bfg/zcml.py index 14b843bb1..1aedd88e4 100644 --- a/repoze/bfg/zcml.py +++ b/repoze/bfg/zcml.py @@ -202,14 +202,14 @@ def resource(context, to_override, override_with): if ':' in override_with: override_package, override_prefix = override_with.split(':', 1) - if path.endswith('/'): - if not override_prefix.endswith('/'): + if path and path.endswith('/'): + if override_prefix and (not override_prefix.endswith('/')): raise ConfigurationError( 'A directory cannot be overridden with a file (put a slash ' 'at the end of override_with if necessary)') - if override_prefix.endswith('/'): - if not path.endswith('/'): + if override_prefix and override_prefix.endswith('/'): + if path and (not path.endswith('/')): raise ConfigurationError( 'A file cannot be overridden with a directory (put a slash ' 'at the end of to_override if necessary)') -- cgit v1.2.3