Permalink
Browse files

Filenames like app:foo-bar.mako should be valid.

  • Loading branch information...
1 parent f272f27 commit b9f54f3c3b391a5964ba14b8fe6828c9a1ca9c0f @sontek sontek committed Sep 22, 2012
Showing with 15 additions and 1 deletion.
  1. +1 −1 pyramid/mako_templating.py
  2. +14 −0 pyramid/tests/test_mako_templating.py
@@ -91,7 +91,7 @@ def __init__(self, settings_prefix=None):
def __call__(self, info):
p = re.compile(
- r'(?P<asset>[\w_.:/]+)'
+ r'(?P<asset>[\w_.:/-]+)'
r'(?:\#(?P<defname>[\w_]+))?'
r'(\.(?P<ext>.*))'
)
@@ -31,6 +31,20 @@ def _getLookup(self, name='mako.'):
from pyramid.mako_templating import IMakoLookup
return self.config.registry.getUtility(IMakoLookup, name=name)
+ def test_hyphen_filenames(self):
+ from pyramid.mako_templating import renderer_factory
+
+ info = DummyRendererInfo({
+ 'name':'app:moon-and-world.mak',
+ 'package':None,
+ 'registry':self.config.registry,
+ 'settings':{},
+ 'type': ''
+ })
+
+ result = renderer_factory(info)
+ self.assertEqual(result.path, 'app:moon-and-world.mak')
+
def test_no_directories(self):
info = DummyRendererInfo({
'name':'pyramid.tests:fixtures/helloworld.mak',

1 comment on commit b9f54f3

Contributor

invisibleroads commented on b9f54f3 Sep 24, 2012

Thanks for the fix! I was having the same issue.

Please sign in to comment.