diff options
| author | Chris Rossi <chris@archimedeanco.com> | 2014-07-22 10:00:47 -0400 |
|---|---|---|
| committer | Chris Rossi <chris@archimedeanco.com> | 2014-07-22 10:00:47 -0400 |
| commit | 4d32f73a86e7223dbdb96b39193d357b38ea1a13 (patch) | |
| tree | 8791dd2e2205c381b47085eef582c107d2b99cb2 | |
| parent | 40c6bfa85a75ffacf23a3ccd128dc5b8bb57a464 (diff) | |
| download | pyramid-4d32f73a86e7223dbdb96b39193d357b38ea1a13.tar.gz pyramid-4d32f73a86e7223dbdb96b39193d357b38ea1a13.tar.bz2 pyramid-4d32f73a86e7223dbdb96b39193d357b38ea1a13.zip | |
Make sure any sequence type works with _query.
| -rw-r--r-- | pyramid/static.py | 2 | ||||
| -rw-r--r-- | 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 |
