handle static urls generated with a query string
| | |
| | | if '_query' in kw: |
| | | query = kw.pop('_query') |
| | | if isinstance(query, text_type): |
| | | result += '?' + native_(query) |
| | | result += '?' + quote_plus(query) |
| | | elif query: |
| | | result += '?' + urlencode(query, doseq=True) |
| | | if '_anchor' in kw: |
| | |
| | | result = inst.generate('package:path/abc def', request, a=1) |
| | | self.assertEqual(result, 'http://example.com/abc%20def') |
| | | |
| | | def test_generate_url_with_custom_query(self): |
| | | inst = self._makeOne() |
| | | registrations = [('http://example.com/', 'package:path/', None)] |
| | | inst._get_registrations = lambda *x: registrations |
| | | request = self._makeRequest() |
| | | result = inst.generate('package:path/abc def', request, a=1, |
| | | _query='(openlayers)') |
| | | self.assertEqual(result, |
| | | 'http://example.com/abc%20def?%28openlayers%29') |
| | | |
| | | def test_generate_url_with_custom_anchor(self): |
| | | inst = self._makeOne() |
| | | registrations = [('http://example.com/', 'package:path/', None)] |