Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Merged
merged 1 commit into from

3 participants

John Anderson Chris McDonough Roy Hyunjin Han
John Anderson

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

Chris McDonough mcdonc merged commit b9f54f3 into from
Chris McDonough
Owner

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

Roy Hyunjin Han

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. John Anderson
This page is out of date. Refresh to see the latest.
2  pyramid/mako_templating.py
View
@@ -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>.*))'
)
14 pyramid/tests/test_mako_templating.py
View
@@ -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.