Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

jinja2.directories no longer needs to be provided at utility creation…

… time
  • Loading branch information...
commit 37f0e50e35f8ad5fc1887789e511e7280b41f6df 1 parent 20c2b76
Rocky Burt rockyburt authored
Showing with 6 additions and 5 deletions.
  1. +4 −4 pyramid_jinja2/__init__.py
  2. +2 −1  pyramid_jinja2/tests/test_it.py
8 pyramid_jinja2/__init__.py
View
@@ -130,15 +130,15 @@ def get_source(self, environment, template):
if template.startswith('asset:'):
newtemplate = template.split(':', 1)[1]
return self._get_asset_source(environment, newtemplate)
+ if not self.searchpath:
+ raise ConfigurationError('Jinja2 template used without a '
+ '``jinja2.directories`` setting')
return FileSystemLoader.get_source(self, environment, template)
def directory_loader_factory(settings):
input_encoding = settings.get('jinja2.input_encoding', 'utf-8')
- directories = settings.get('jinja2.directories')
- if directories is None or directories.strip() == '':
- raise ConfigurationError('Jinja2 template used without a '
- '``jinja2.directories`` setting')
+ directories = settings.get('jinja2.directories') or ''
if isinstance(directories, basestring):
directories = splitlines(directories)
directories = [abspath_from_resource_spec(d) for d in directories]
3  pyramid_jinja2/tests/test_it.py
View
@@ -73,7 +73,8 @@ def test_no_directories(self):
'package': None,
'registry': self.config.registry,
})
- self.assertRaises(ConfigurationError, self._callFUT, info)
+ renderer = self._callFUT(info)
+ self.assertRaises(ConfigurationError, lambda: renderer({}, {}))
def test_no_environment(self):
from pyramid_jinja2 import IJinja2Environment
Please sign in to comment.
Something went wrong with that request. Please try again.