Skip to content
This repository

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

Merged
merged 1 commit into from over 1 year ago

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 September 22, 2012
Chris McDonough mcdonc closed this September 22, 2012
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

Showing 1 unique commit by 1 author.

Sep 22, 2012
John Anderson Filenames like app:foo-bar.mako should be valid. b9f54f3
This page is out of date. Refresh to see the latest.
2  pyramid/mako_templating.py
@@ -91,7 +91,7 @@ def __init__(self, settings_prefix=None):
91 91
 
92 92
     def __call__(self, info):
93 93
         p = re.compile(
94  
-                r'(?P<asset>[\w_.:/]+)'
  94
+                r'(?P<asset>[\w_.:/-]+)'
95 95
                 r'(?:\#(?P<defname>[\w_]+))?'
96 96
                 r'(\.(?P<ext>.*))'
97 97
                 )
14  pyramid/tests/test_mako_templating.py
@@ -31,6 +31,20 @@ def _getLookup(self, name='mako.'):
31 31
         from pyramid.mako_templating import IMakoLookup
32 32
         return self.config.registry.getUtility(IMakoLookup, name=name)
33 33
 
  34
+    def test_hyphen_filenames(self):
  35
+        from pyramid.mako_templating import renderer_factory
  36
+
  37
+        info = DummyRendererInfo({
  38
+            'name':'app:moon-and-world.mak',
  39
+            'package':None,
  40
+            'registry':self.config.registry,
  41
+            'settings':{},
  42
+            'type': ''
  43
+        })
  44
+
  45
+        result = renderer_factory(info)
  46
+        self.assertEqual(result.path, 'app:moon-and-world.mak')
  47
+
34 48
     def test_no_directories(self):
35 49
         info = DummyRendererInfo({
36 50
             'name':'pyramid.tests:fixtures/helloworld.mak',
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.