From 4d32f73a86e7223dbdb96b39193d357b38ea1a13 Mon Sep 17 00:00:00 2001 From: Chris Rossi Date: Tue, 22 Jul 2014 10:00:47 -0400 Subject: Make sure any sequence type works with _query. --- pyramid/static.py | 2 +- pyramid/tests/test_static.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pyramid/static.py b/pyramid/static.py index 34fc3f55c..0cbb5533f 100644 --- a/pyramid/static.py +++ b/pyramid/static.py @@ -223,7 +223,7 @@ class QueryStringCacheBuster(Md5AssetTokenGenerator): if isinstance(query, dict): query[self.param] = token else: - kw['_query'] = query + [(self.param, token)] + kw['_query'] = tuple(query) + ((self.param, token),) return subpath, kw diff --git a/pyramid/tests/test_static.py b/pyramid/tests/test_static.py index aca5c4bbd..134bea25e 100644 --- a/pyramid/tests/test_static.py +++ b/pyramid/tests/test_static.py @@ -471,7 +471,13 @@ class TestQueryStringCacheBuster(unittest.TestCase): fut = self._makeOne().pregenerate self.assertEqual( fut('foo', ('bar',), {'_query': [('a', 'b')]}), - (('bar',), {'_query': [('a', 'b'), ('x', 'foo')]})) + (('bar',), {'_query': (('a', 'b'), ('x', 'foo'))})) + + def test_pregenerate_query_is_tuple_of_tuples(self): + fut = self._makeOne().pregenerate + self.assertEqual( + fut('foo', ('bar',), {'_query': (('a', 'b'),)}), + (('bar',), {'_query': (('a', 'b'), ('x', 'foo'))})) class DummyContext: pass -- cgit v1.2.3