Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Merged
merged 1 commit into from

3 participants

@sontek

Right now if you want to use hyphens in your filenames they wouldn't be allowed.

@mcdonc mcdonc merged commit b9f54f3 into Pylons:master
@mcdonc
Owner

Only a monster could have not applied this patch. Thanks!

@invisibleroads

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 22, 2012
  1. @sontek
This page is out of date. Refresh to see the latest.
View
2  pyramid/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>.*))'
)
View
14 pyramid/tests/test_mako_templating.py
@@ -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',
Something went wrong with that request. Please try again.