From eb9fbf5f24b5e41cadd1eac8ca970ba819ecb6a5 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 23 Sep 2009 10:24:42 +0000 Subject: Features -------- - Speed up ``repoze.bfg.encode.urlencode`` (nee' ``repoze.bfg.url.urlencode``) slightly. - Speed up ``repoze.bfg.traversal.model_path`` and ``repoze.bfg.traversal.model_path_tuple`` slightly. Internal -------- - Move ``repoze.bfg.traversal._url_quote`` into ``repoze.bfg.encode`` as ``url_quote``. Backwards Incompatibilities --------------------------- - We previously had a Unicode-aware wrapper for the ``urllib.urlencode`` function named ``repoze.bfg.url.urlencode`` which delegated to the stdlib function, but which marshalled all unicode values to utf-8 strings before calling the stdlib version. A newer replacement now lives in ``repoze.bfg.encode`` (old imports will still work). The replacement does not delegate to the stdlib. The replacement diverges from the stdlib implementation and the previous ``repoze.bfg.url`` url implementation inasmuch as its ``doseq`` argument is a decoy: it always behaves in the ``doseq=True`` way (which is the only sane behavior) for speed purposes. The old import location (``repoze.bfg.url.urlencode``) still functions and has not been deprecated. --- repoze/bfg/tests/test_url.py | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'repoze/bfg/tests/test_url.py') diff --git a/repoze/bfg/tests/test_url.py b/repoze/bfg/tests/test_url.py index 5833b8880..1199328e3 100644 --- a/repoze/bfg/tests/test_url.py +++ b/repoze/bfg/tests/test_url.py @@ -129,34 +129,6 @@ class ModelURLTests(unittest.TestCase): result = self._callFUT(root, request) self.assertEqual(result, 'http://example.com:5432/') -class UrlEncodeTests(unittest.TestCase): - def _callFUT(self, query, doseq=False): - from repoze.bfg.url import urlencode - return urlencode(query, doseq) - - def test_ascii_only(self): - result = self._callFUT([('a',1), ('b',2)]) - self.assertEqual(result, 'a=1&b=2') - - def test_unicode_key(self): - la = unicode('LaPe\xc3\xb1a', 'utf-8') - result = self._callFUT([(la, 1), ('b',2)]) - self.assertEqual(result, 'LaPe%C3%B1a=1&b=2') - - def test_unicode_val_single(self): - la = unicode('LaPe\xc3\xb1a', 'utf-8') - result = self._callFUT([('a', la), ('b',2)]) - self.assertEqual(result, 'a=LaPe%C3%B1a&b=2') - - def test_unicode_val_multiple(self): - la = [unicode('LaPe\xc3\xb1a', 'utf-8')] * 2 - result = self._callFUT([('a', la), ('b',2)], doseq=True) - self.assertEqual(result, 'a=LaPe%C3%B1a&a=LaPe%C3%B1a&b=2') - - def test_dict(self): - result = self._callFUT({'a':1}) - self.assertEqual(result, 'a=1') - class TestRouteUrl(unittest.TestCase): def setUp(self): cleanUp() -- cgit v1.2.3