summaryrefslogtreecommitdiff
path: root/repoze/bfg/tests
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-01-22 08:59:51 +0000
committerChris McDonough <chrism@agendaless.com>2009-01-22 08:59:51 +0000
commit74db82d177093f4b1102d70832f8abd9b894dd61 (patch)
tree0125dfd8974a79b1a5a925afc0637a787af9f466 /repoze/bfg/tests
parent5b9105ad8de57f21269608b1536720a5425a1fd1 (diff)
downloadpyramid-74db82d177093f4b1102d70832f8abd9b894dd61.tar.gz
pyramid-74db82d177093f4b1102d70832f8abd9b894dd61.tar.bz2
pyramid-74db82d177093f4b1102d70832f8abd9b894dd61.zip
- The ``unicode_path_segments`` configuration variable and the
``BFG_UNICODE_PATH_SEGMENTS`` configuration variable have been removed. Path segments are now always passed to model ``__getitem__`` methods as unicode. "True" has been the default for this setting since 0.5.4, but changing this configuration setting to false allowed you to go back to passing raw path element strings to model ``__getitem__`` methods. This services a speed goal (we get about +80 req/s by removing the check), and it's clearer just to always expect unicode path segments in model ``__getitem__`` methods.
Diffstat (limited to 'repoze/bfg/tests')
-rw-r--r--repoze/bfg/tests/test_settings.py17
-rw-r--r--repoze/bfg/tests/test_traversal.py14
2 files changed, 0 insertions, 31 deletions
diff --git a/repoze/bfg/tests/test_settings.py b/repoze/bfg/tests/test_settings.py
index 8c1fe2c39..97fe9d026 100644
--- a/repoze/bfg/tests/test_settings.py
+++ b/repoze/bfg/tests/test_settings.py
@@ -14,14 +14,12 @@ class TestSettings(unittest.TestCase):
self.assertEqual(settings.reload_templates, False)
self.assertEqual(settings.debug_notfound, False)
self.assertEqual(settings.debug_authorization, False)
- self.assertEqual(settings.unicode_path_segments, True)
def test_with_option(self):
settings = self._makeOne(reload_templates=True)
self.assertEqual(settings.reload_templates, True)
self.assertEqual(settings.debug_notfound, False)
self.assertEqual(settings.debug_authorization, False)
- self.assertEqual(settings.unicode_path_segments, True)
class TestGetOptions(unittest.TestCase):
def _callFUT(self, *arg, **kw):
@@ -94,21 +92,6 @@ class TestGetOptions(unittest.TestCase):
self.assertEqual(result['debug_notfound'], True)
self.assertEqual(result['debug_authorization'], True)
- def test_unicode_path_segments(self):
- result = self._callFUT({})
- self.assertEqual(result['unicode_path_segments'], True)
- result = self._callFUT({'unicode_path_segments':'false'})
- self.assertEqual(result['unicode_path_segments'], False)
- result = self._callFUT({'unicode_path_segments':'t'})
- self.assertEqual(result['unicode_path_segments'], True)
- result = self._callFUT({'unicode_path_segments':'1'})
- self.assertEqual(result['unicode_path_segments'], True)
- result = self._callFUT({}, {'BFG_UNICODE_PATH_SEGMENTS':'1'})
- self.assertEqual(result['unicode_path_segments'], True)
- result = self._callFUT({'unicode_path_segments':'false'},
- {'BFG_UNICODE_PATH_SEGMENTS':'1'})
- self.assertEqual(result['unicode_path_segments'], True)
-
def test_originals_kept(self):
result = self._callFUT({'a':'i am so a'})
self.assertEqual(result['a'], 'i am so a')
diff --git a/repoze/bfg/tests/test_traversal.py b/repoze/bfg/tests/test_traversal.py
index 873291bb8..b1a94617e 100644
--- a/repoze/bfg/tests/test_traversal.py
+++ b/repoze/bfg/tests/test_traversal.py
@@ -184,20 +184,6 @@ class ModelGraphTraverserTests(unittest.TestCase):
environ = self._getEnviron(PATH_INFO='/%s' % segment)
self.assertRaises(TypeError, policy, environ)
- def test_non_utf8_path_segment_str_path_segments_succeeds(self):
- defaultkw = {'unicode_path_segments':False}
- settings = DummySettings(**defaultkw)
- from repoze.bfg.interfaces import ISettings
- import zope.component
- gsm = zope.component.getGlobalSiteManager()
- gsm.registerUtility(settings, ISettings)
- foo = DummyContext()
- root = DummyContext(foo)
- policy = self._makeOne(root)
- segment = unicode('LaPe\xc3\xb1a', 'utf-8').encode('utf-16')
- environ = self._getEnviron(PATH_INFO='/%s' % segment)
- ctx, name, subpath = policy(environ) # test is: this doesn't fail
-
class RoutesModelTraverserTests(unittest.TestCase):
def _getTargetClass(self):
from repoze.bfg.traversal import RoutesModelTraverser