From e7745ac72ff5c5c499722a8cfcc589a77201fc9a Mon Sep 17 00:00:00 2001 From: Randall Leeds Date: Thu, 10 Jul 2014 16:31:31 -0700 Subject: Fix static views with package root spec patterns --- CHANGES.txt | 3 +++ pyramid/config/views.py | 2 +- pyramid/tests/test_config/test_views.py | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index b5d08c8ff..5a0edc566 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -67,6 +67,9 @@ Bug Fixes - Fix a failing unittest caused by differing mimetypes across various OSs. See https://github.com/Pylons/pyramid/issues/1405 +- Fix route generation for static view asset specifications having no path. + See https://github.com/Pylons/pyramid/pull/1377 + Docs ---- diff --git a/pyramid/config/views.py b/pyramid/config/views.py index e4171b0c5..ba3981388 100644 --- a/pyramid/config/views.py +++ b/pyramid/config/views.py @@ -1955,7 +1955,7 @@ class StaticURLInfo(object): sep = os.sep else: sep = '/' - if not spec.endswith(sep): + if not spec.endswith(sep) and not spec.endswith(':'): spec = spec + sep # we also make sure the name ends with a slash, purely as a diff --git a/pyramid/tests/test_config/test_views.py b/pyramid/tests/test_config/test_views.py index a82f7f257..b0d03fb72 100644 --- a/pyramid/tests/test_config/test_views.py +++ b/pyramid/tests/test_config/test_views.py @@ -3902,7 +3902,7 @@ class TestStaticURLInfo(unittest.TestCase): inst = self._makeOne() config = self._makeConfig() inst.add(config, 'http://example.com', 'package:') - expected = [('http://example.com/', 'package:', None)] + expected = [('http://example.com/', 'package:', None, None)] self._assertRegistrations(config, expected) def test_add_url_withendslash(self): -- cgit v1.2.3