diff options
| author | John Anderson <sontek@gmail.com> | 2015-01-01 20:26:22 -0800 |
|---|---|---|
| committer | John Anderson <sontek@gmail.com> | 2015-01-01 20:26:22 -0800 |
| commit | e094ab229eed6f8bf9e7a6a4d4406faefece41e4 (patch) | |
| tree | 58e57c55b4f4b749a27eecbff0c3cae2c213b272 | |
| parent | 9e7248258800ef2c7072f497901172ab94988708 (diff) | |
| download | pyramid-e094ab229eed6f8bf9e7a6a4d4406faefece41e4.tar.gz pyramid-e094ab229eed6f8bf9e7a6a4d4406faefece41e4.tar.bz2 pyramid-e094ab229eed6f8bf9e7a6a4d4406faefece41e4.zip | |
Added py3 support
| -rw-r--r-- | pyramid/tests/test_config/test_factories.py | 6 | ||||
| -rw-r--r-- | pyramid/util.py | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/pyramid/tests/test_config/test_factories.py b/pyramid/tests/test_config/test_factories.py index 5ae486c4b..e93ba6908 100644 --- a/pyramid/tests/test_config/test_factories.py +++ b/pyramid/tests/test_config/test_factories.py @@ -120,13 +120,17 @@ class TestFactoriesMixin(unittest.TestCase): def boomshaka(r): pass name = text_(b'La Pe\xc3\xb1a', 'utf-8') config.add_request_method(boomshaka, name=name) + + name2 = b'La Pe\xc3\xb1a' + config.add_request_method(boomshaka, name=name2) + exts = config.registry.getUtility(IRequestExtensions) inst = InstancePropertyMixin() def set_extensions(): inst._set_extensions(exts) + self.assertRaises(ValueError, set_extensions) - self.assertTrue(name in exts.methods) class TestDeprecatedFactoriesMixinMethods(unittest.TestCase): def setUp(self): diff --git a/pyramid/util.py b/pyramid/util.py index e9f5760a6..6ab621fd4 100644 --- a/pyramid/util.py +++ b/pyramid/util.py @@ -113,7 +113,7 @@ class InstancePropertyMixin(object): method = fn.__get__(self, self.__class__) try: setattr(self, name, method) - except UnicodeEncodeError: + except (UnicodeEncodeError, TypeError): msg = ( '`name="%s"` is invalid. `name` must be ascii because it is ' 'used on __name__ of the method' |
