summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2014-11-13 15:49:29 -0600
committerMichael Merickel <michael@merickel.org>2014-11-13 15:49:29 -0600
commitaf0290407b50a18664c9ae28a4c01d4cfb27920b (patch)
tree8997e3f7cb19ca30b634ff69e7f34ad46bdb0e7a
parentc617b7df97a326ca010ddb196978169e2a178c4a (diff)
parent0b0ea0a6fff1d238bcc419c7a4feb72ad4969175 (diff)
downloadpyramid-af0290407b50a18664c9ae28a4c01d4cfb27920b.tar.gz
pyramid-af0290407b50a18664c9ae28a4c01d4cfb27920b.tar.bz2
pyramid-af0290407b50a18664c9ae28a4c01d4cfb27920b.zip
Merge pull request #1377 from tilgovi/package-root-static-view-spec
Static view registrations with package root asset specifications
-rw-r--r--CHANGES.txt3
-rw-r--r--CONTRIBUTORS.txt2
-rw-r--r--pyramid/config/views.py2
-rw-r--r--pyramid/tests/test_config/test_views.py7
4 files changed, 13 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 76f9bc84e..a893ebae4 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -70,6 +70,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/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index c77d3e92c..66f029cb7 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -232,3 +232,5 @@ Contributors
- Amit Mane, 2014/01/23
- Fenton Travers, 2014/05/06
+
+- Randall Leeds, 2014/11/11
diff --git a/pyramid/config/views.py b/pyramid/config/views.py
index db67d2582..c01b72e12 100644
--- a/pyramid/config/views.py
+++ b/pyramid/config/views.py
@@ -1951,7 +1951,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 39b8ba70d..b0d03fb72 100644
--- a/pyramid/tests/test_config/test_views.py
+++ b/pyramid/tests/test_config/test_views.py
@@ -3898,6 +3898,13 @@ class TestStaticURLInfo(unittest.TestCase):
('http://example.com/', 'anotherpackage:path/', None, None)]
self._assertRegistrations(config, expected)
+ def test_add_package_root(self):
+ inst = self._makeOne()
+ config = self._makeConfig()
+ inst.add(config, 'http://example.com', 'package:')
+ expected = [('http://example.com/', 'package:', None, None)]
+ self._assertRegistrations(config, expected)
+
def test_add_url_withendslash(self):
inst = self._makeOne()
config = self._makeConfig()