diff options
| author | Chris Rossi <chris@archimedeanco.com> | 2014-07-16 17:40:46 -0400 |
|---|---|---|
| committer | Chris Rossi <chris@archimedeanco.com> | 2014-07-16 17:40:46 -0400 |
| commit | 737016eb553701ec154e33d212379a2356917e4c (patch) | |
| tree | 5e4946b11fcfdf1fd40d37fb5e89facdd5300858 | |
| parent | eac3ff43f78a33d05e634cd5b4866f7681db34c3 (diff) | |
| download | pyramid-737016eb553701ec154e33d212379a2356917e4c.tar.gz pyramid-737016eb553701ec154e33d212379a2356917e4c.tar.bz2 pyramid-737016eb553701ec154e33d212379a2356917e4c.zip | |
Handle list of tuples as query string.
| -rw-r--r-- | pyramid/static.py | 6 | ||||
| -rw-r--r-- | pyramid/tests/test_static.py | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/pyramid/static.py b/pyramid/static.py index 9d691ca46..4ae00b056 100644 --- a/pyramid/static.py +++ b/pyramid/static.py @@ -206,7 +206,11 @@ class QueryStringCacheBuster(object): self.token = token def pregenerate(self, token, subpath, kw): - kw.setdefault('_query', {})[self.param] = token + query = kw.setdefault('_query', {}) + if isinstance(query, dict): + query[self.param] = token + else: + kw['_query'] = query + [(self.param, token)] return subpath, kw diff --git a/pyramid/tests/test_static.py b/pyramid/tests/test_static.py index 5edb70b50..f7b580df2 100644 --- a/pyramid/tests/test_static.py +++ b/pyramid/tests/test_static.py @@ -453,6 +453,12 @@ class TestQueryStringCacheBuster(unittest.TestCase): fut('foo', ('bar',), {}), (('bar',), {'_query': {'y': 'foo'}})) + def test_pregenerate_query_is_already_tuples(self): + fut = self._makeOne().pregenerate + self.assertEqual( + fut('foo', ('bar',), {'_query': [('a', 'b')]}), + (('bar',), {'_query': [('a', 'b'), ('x', 'foo')]})) + class DummyContext: pass |
